[Planetlab-users] Restarting a program after reboot

Neil Spring nspring at cs.umd.edu
Fri Sep 23 10:53:41 EDT 2005


Alex,

http://lists.planet-lab.org/pipermail/users/2004-November/000866.html

Below is my current rc.vinit.  It works reasonably well.  You  
obviously don't want to start scriptroute, but the rest may be fine.

-neil


#!/bin/sh

# $1 is the first arg, defined to be "start" or "stop"

# part of the "stock" rc.vinit, at least temporarily...
test -e /etc/ssh/fetch_keys && /bin/sh /etc/ssh/fetch_keys

# all I want is logrotate in cron.daily
rm -f /etc/cron.daily/[^l]*
rm -f /etc/cron.hourly/*
rm -f /etc/cron.weekly/*

# because I don't see the point of anything else.
chmod a+r /var/log/*

/usr/bin/logger rc.vinit running $1 at `date`

case "$1" in
     'start')
         /etc/init.d/syslog start
         /etc/init.d/crond start
         /etc/init.d/scriptroute start
         /etc/init.d/scriptroute-thttp start
         /sbin/chkconfig syslog on
         /sbin/chkconfig crond on
         ;;
     'stop')
         /etc/init.d/scriptroute-thttp stop
         /etc/init.d/scriptroute stop
         /etc/init.d/crond stop
         /etc/init.d/syslog stop
         ;;
     'restart')
         /etc/init.d/syslog restart
         /etc/init.d/crond restart
         /etc/init.d/scriptroute restart
         /etc/init.d/scriptroute-thttp restart
         ;;
     *)
         echo rc.vinit was called with $1 as an argument
         ;;
esac

/usr/bin/logger rc.vinit completed $1 at `date`



On Sep 23, 2005, at 10:28 AM, Alex Sherman wrote:

>
>
> Hi
>
> I want to make sure that my program starts up when a planetlab machine
> is rebooted. A while back I found a hint somewhere in the FAQ
> that recommended to modify the /etc/rc.vinit to have crond started
> at boot time. (And that runs a command in my crontab)
>
> Below is the pasted script suggested in the FAQ. However, I find that
> on some machines crond is not running. I am not sure whether this is
> a problem with the script or crond starts up and then dies for some
> unexplained reason.
>
> Any suggestions will be appreciated.
>
> -Alex
>
> my /etc/rc.vinit:
>
> #!/bin/sh
>
> case "$1" in
>     'start')
>         /etc/init.d/crond start
>         ;;
>     'stop')
>         /etc/init.d/crond stop
>         ;;
>     'restart')
>         /etc/init.d/crond restart
>         ;;
>     *)
>         echo rc.vinit was called with $1 as an argument
>         ;;
> esac
>
> /usr/bin/logger rc.vinit completed $1 at `date`
>
> _______________________________________________
> Users mailing list: Users at lists.planet-lab.org
> https://lists.planet-lab.org/mailman/listinfo/users
>



More information about the Users mailing list