User Tools

Site Tools


packages:userscripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
packages:userscripts [2011-02-01 18:12]
SamChi - extended/finished irssi script
packages:userscripts [2011-02-02 21:37] (current)
SamChi - note about restart and reload
Line 1: Line 1:
 +
 +
 +====== UserScripts ======
 rc-scripts-user allows users to run scripts at system startup and shutdown. ​ rc-scripts-user allows users to run scripts at system startup and shutdown. ​
  
-Create ~/​.config/​init.d/​script_name. It must accept one argument, it will be either "​start"​ or "​stop"​. ​ 
  
-Example ​~/​.config/​init.d/​irssi ​+ 
 +===== how to use ===== 
 +Create ​~/​.config/​init.d/​script_name.init. It must accept one argument, it will be either "​start"​ or "​stop"​. Scripts must also allow "​restart"​ and "​reload"​ arguments, but are not required to perform any action in those cases.  
 + 
 + 
 + 
 +====== Sample user scripts ====== 
 + 
 + 
 +==== irssi ==== 
 +~/​.config/​init.d/​irssi.init  
 + 
  
 <​file>#​!/​bin/​sh <​file>#​!/​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 # download fifo_remote.pl irssi script to control it remotelly
Line 42: Line 59:
         install)         install)
                 install_fifo_remote                 install_fifo_remote
 +                ;;
 +esac
 +</​file>​
 +
 +
 +==== dropbox ====
 +~/​.config/​init.d/​dropbox.init ​
 +
 +
 +
 +<​file>#​!/​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 esac
 </​file>​ </​file>​
  
packages/userscripts.1296580369.txt.gz · Last modified: 2011-02-01 18:12 by SamChi