Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17912

why does the script doesn't run as source but run as python?

$
0
0
[machineA tmp]# service puppet status puppet is stopped [machineA tmp]# /etc/cron.daily/ensure_puppet [machineA tmp]# service puppet status puppet is stopped [machineA tmp]# python /etc/cron.daily/ensure_puppet Starting puppet agent: [ OK ] [machineA tmp]# service puppet status puppet (pid 16378) is running... 

#!/usr/bin/python import platform import os import commands def chkrun(): output = commands.getoutput('ps -A') if 'puppet' in output: return 1 #running else: return 0 #not running def run(): if chkrun() == 0: if platform.dist()[1][0] == '7': os.system("/usr/sbin/service puppet start") else: os.system("/sbin/service puppet start") run() 
submitted by /u/juniorsysadmin1
[link] [comments]

Viewing all articles
Browse latest Browse all 17912

Trending Articles