How to restart cron on Sun OS 5.10

Posted on 2010-01-05
Last Modified: 2013-12-27
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
Question by:amit_g
    LVL 12

    Accepted Solution

    This should do the trick:
      svcadm restart svc:/system/cron:default

    Check out the manpages for svcadm and svcs.
    LVL 58

    Author Comment

    What is /system/cron? There is no cron in /system.
    LVL 58

    Author Comment

    Nevermind, should have read svsc man before posting :)
    LVL 12

    Expert Comment

    Yup, the 'svc:/system/cron:default' is the full FMRI (fault management resource identifier).
    The following abbreviated version should also work:
      svcadm restart cron
    LVL 22

    Assisted Solution

    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
    LVL 9

    Expert Comment

    svcadm restart -t system/cron:default
    LVL 58

    Author Closing Comment

    Worked like a charm. For the duplicate cron, the processes were killed using kill. Thanks everyone.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    This tutorial goes over how to archive and restore FreeBSD jails that are managed by ezjail.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now