On Friday 02 May 2008 06:09, Florent Daignière wrote: > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2008-05-01 13:47:49]: > > > Author: toad > > Date: 2008-05-01 13:47:49 +0000 (Thu, 01 May 2008) > > New Revision: 19643 > > > > Added: > > trunk/apps/new_installer/res/unix/bin/install_autostart.sh > > Modified: > > trunk/apps/new_installer/ProcessPanel.Spec.xml > > trunk/apps/new_installer/install.xml > > Log: > > Auto-start on reboot on unix. > > Currently we use a cron job. This will work on non-root, and doesn't require the LSB-utils to be installed (they usually aren't). > > However, we should make the script detect if it's run as root and the LSB utils exist, and if so, use the useradd and install_initd scripts. > > Added: trunk/apps/new_installer/res/unix/bin/install_autostart.sh > > =================================================================== > > --- trunk/apps/new_installer/res/unix/bin/install_autostart.sh > > (rev 0) > > +++ trunk/apps/new_installer/res/unix/bin/install_autostart.sh > > 2008-05-01 13:47:49 UTC (rev 19643) > > @@ -0,0 +1,31 @@ > > +#!/bin/sh > > + > > +. "$HOME/_install_toSource.sh" > > +cd "$INSTALL_PATH" > > + > > +# FIXME if we are running as root, and they are installed use the LSB utilities, with crontab as a fallback. > > +# See here: > > +# http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/initsrcinstrm.html > > +# http://refspecs.linux-foundation.org/LSB_3.2.0/LSB-Core-generic/LSB-Core-generic/useradd.html > > +if test -e autostart.install > > +then > > + echo "Enabling auto-start." > > + if test -x `which crontab` > > + then > > + echo "Installing cron job to start Freenet on reboot..." > > + rm -f crontab.tmp > > + crontab -l > crontab.tmp > > + echo "@reboot \"$INSTALL_PATH/run.sh\" start" >> crontab.tmp > > + if crontab crontab.tmp > > + then > > + echo Installed cron job. > > + else > > + echo Could not install cron job, you will have to run > > run.sh start manually to start Freenet after a reboot. > > + fi > > + rm crontab.tmp > > + else > > + echo Cron appears not to be installed, you will have to run > > run.sh start manually to start Freenet after a reboot. > > + fi > > +else > > + echo Auto-start is disabled, you will have to run run.sh start manually to start Freenet after a reboot. > > +fi > > Three things here: > 1) Cron is going to send an mail to the user with the output of > the crontab entry... in our case we don't want that to happen. > You should either silent the output redirecting stdout and > stderr or create a special parameter for handling cron in run.sh > 2) You shouldn't use a "static" temporary filename (use $$ or > $RANDOM). If you need to you can even use autostart.install > itself ;) > 3) You don't delete autostart.install, do you ? > > A side note : what about adding a comment you could grep for in the cron > entry? That would be much cleaner than grepping for the whole line and > would allow us to change the parameters of run.sh if needed ;) > Nextgens has fixed these issues. Thanks!
pgpGsxiltzUMl.pgp
Description: PGP signature
_______________________________________________ Devl mailing list Devl@freenetproject.org http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl