Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 10316
  • Last Modified:

How to restart cron on Sun OS 5.10

How to restart cron on Sun OS 5.10 without restarting the server? The system administrator used

/etc/cron restart

and killed the FIFO file. I believe now it is running two cron daemons as the log show each scheduled script being run twice. ps -f grep cron shows

    root  6147     1   0   Dec 29 ?           0:01 /usr/sbin/cron
    root  7377     1   0   Dec 29 ?           0:01 /etc/cron restart

The log file example

>  CMD: /somedir/subdir/script1>/dev/null 2>&1
>  root 24236 c Tue Jan  5 04:00:00 2010
>  CMD: /somedir/subdir/script2>/dev/null 2>&1
>  root 24237 c Tue Jan  5 04:00:00 2010
>  CMD: /somedir/subdir/script3>/dev/null 2>&1
>  root 24240 c Tue Jan  5 04:00:00 2010
>  CMD: /somedir/subdir/script1>/dev/null 2>&1
>  root 24258 c Tue Jan  5 04:00:00 2010
>  CMD: /somedir/subdir/script2>/dev/null 2>&1
>  root 24259 c Tue Jan  5 04:00:00 2010
>  CMD: /somedir/subdir/script3>/dev/null 2>&1
>  root 24266 c Tue Jan  5 04:00:01 2010

The uname -a returns

SunOS ServerName 5.10 Generic sun4u sparc SUNW,Sun-Fire-V240

ls -l /etc/init.d/cron returns

/etc/init.d/cron: No such file or directory
0
amit_g
Asked:
amit_g
2 Solutions
 
larsrohrCommented:
This should do the trick:
  svcadm restart svc:/system/cron:default

Check out the manpages for svcadm and svcs.
0
 
amit_gAuthor Commented:
What is /system/cron? There is no cron in /system.
0
 
amit_gAuthor Commented:
Nevermind, should have read svsc man before posting :)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
larsrohrCommented:
Yup, the 'svc:/system/cron:default' is the full FMRI (fault management resource identifier).
The following abbreviated version should also work:
  svcadm restart cron
0
 
Brian UtterbackPrinciple Software EngineerCommented:
If there are really two crons running, then you will need to kill the extra one. It might tricky to figure out which one is the smf controlled one, so you probably need to get rid of them both.

Do this:

svcadm disable cron
pkill cron
sleep 5
pkill -9 cron
svcadm enable cron
0
 
AmolCommented:
svcadm restart -t system/cron:default
0
 
amit_gAuthor Commented:
Worked like a charm. For the duplicate cron, the processes were killed using kill. Thanks everyone.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now