packages:userscripts
This is an old revision of the document!
Table of Contents
UserScripts
rc-scripts-user allows users to run scripts at system startup and shutdown.
how to use
Create ~/.config/init.d/script_name. It must accept one argument, it will be either “start” or “stop”.
Sample user scripts
irssi
~/.config/init.d/irssi
#!/bin/sh # TODO: replace pidof with something that takes into account # only processes from this user # download fifo_remote.pl irssi script to control it remotelly REMOTE="$HOME/.irssi/remote-control" install_fifo_remote() { install -d ~/.irssi/scripts/autorun cd ~/.irssi/scripts wget http://ep09.pld-linux.org/~sparky/fifo_remote.pl cd autorun ln -s ../fifo_remote.pl . rm $REMOTE mkfifo $REMOTE chmod 600 $REMOTE } case "$1" in start) [ -p "$REMOTE" ] || install_fifo_remote if ! pidof irssi > /dev/null; then screen -d -m -S irssi irssi fi ;; stop) pidof irssi > /dev/null || exit 0 echo "quit System shutdown" > $REMOTE usleep 10000 if pidof irssi > /dev/null; then sleep 1 killall -INT irssi fi ;; install) install_fifo_remote ;; esac
dropbox
~/.config/init.d/dropbox
#!/bin/sh case "$1" in start) exec /sbin/start-stop-daemon --start --background \ --pidfile $HOME/.dropbox/dropbox.pid \ --exec /usr/bin/dropboxd ;; stop) exec /sbin/start-stop-daemon --stop \ --retry TERM/2/TERM/6/KILL/2 -s TERM \ --pidfile $HOME/.dropbox/dropbox.pid ;; esac
packages/userscripts.1296589412.txt.gz · Last modified: 2011-02-01 20:43 by SamChi