# HG changeset patch # User Paul Issot # Date 1208604364 -3600 # Node ID 16ab7f88b9d85d3646533c2b7db2b28a37ccea6a # Parent 796d31b08d96dbe121af852b3fbacfb904ef90d5 Add cron and local.sh to Handbook (en) diff -r 796d31b08d96 -r 16ab7f88b9d8 en/doc/handbook/system-admin.html --- a/en/doc/handbook/system-admin.html Tue Apr 15 22:28:47 2008 +0100 +++ b/en/doc/handbook/system-admin.html Sat Apr 19 12:26:04 2008 +0100 @@ -36,6 +36,8 @@
  • Language and keyboard.
  • Install the Bash shell.
  • Set the system time.
  • +
  • Execute scheduled commands.
  • +
  • Add commands at boot time.
  • @@ -187,6 +189,66 @@ # hwclock -s --utc + +

    Execute scheduled commands

    +

    +The daemon 'crond' allows you to run commands automatically at a scheduled specific date or time. This is very +useful for routine tasks such as system administration. The directory cron uses is +/var/spool/cron/crontabs. +

    +

    +Each user of the system can have his/her own tasks, they are defined in the file: /var/spool/cron/crontabs/user. +The crontab utility allows you amongst other things, to list the tasks specific to the user. The syntax of the +files is as follows: +

    +
    mm hh dd MMM DDD command > log
    +
    +

    +We will create a file with root priviledges and test the daemon 'crond' with a task performed every minute - +writing the date to a file /tmp/crond.test. It should be noted that the utility has an option +crontab for editing cron file using 'vi', this is not provided by SliTaz. In it's place you can use +GNU nano (<Ctrl+X> to save & exit): +

    +
     # nano /var/spool/cron/crontabs/root
    +
    +
    * * * * * date >> /tmp/crond.test
    +
    +

    +Launch crond with the option -b (background), +configured via /etc/daemons.conf and using the startup script: +

    +
     # /etc/init.d/crond start
    +
    +

    +You can wait a few minutes and view the contents of the file: /tmp/crond.test... OK: +

    +
     # cat /tmp/crond.test
    +
    +

    +To stop or restart the daemon crond: +

    +
     # /etc/init.d/crond stop
    + Or :
    + # /etc/init.d/crond restart
    +
    +

    Invoke the daemon crond on every boot

    +

    +To launch the daemon 'crond' each time you boot the system, just add it to the variable START_DAEMONS +in the configuration file /etc/rcS.conf, either before or after the web server or SSH server. +

    + + +

    Add commands to be executed at boot

    +

    +During the boot process, various scripts are executed to configure services, such as the start of the +web server, networking etc. On SliTaz there is a script /etc/init.d/local.sh which allows +you to add commands to be launched at system startup. You can also create new scripts in /etc/init.d, +their links in /etc/rc.scripts for shell scripts and use /etc/rc.d for links to the startup script daemon in +/etc/rcS.conf: +

    +
     # nano /etc/init.d/local.sh
    +
    +