services/lispirc (1136 bytes)
1 #!/sbin/openrc-run 2 3 name="ii-lchat-worker-1" 4 description="IRC client worker #1" 5 6 command="/home/jose/src/sh/irc-connect" 7 command_args="(irc.libera.chat) <YOUR NICKSERV IDENT> <YOUR NICKSERV PASSWORD> <IRC FILES PATH> CHANNELS CHANNELS CHANNELS (eg. \#lisp)" 8 # for example: 9 #command_args="irc.libera.chat equwal 'PASSWORD WITH ESCAPES' /home/jose/scr/irc \#lisp \#commonlisp \#libreboot" 10 command_user="<YOUR USER>" 11 pidfile="/run/${RC_SVCNAME}.pid" 12 command_background="yes" 13 14 depend() { 15 need net 16 after logger 17 } 18 19 start_pre() { 20 checkpath --directory --owner "$command_user:$command_user" --mode 0755 /home/jose/scr/irc 21 } 22 23 stop() { 24 if [ -f "$pidfile" ]; then 25 local pid=$(cat "$pidfile") 26 ebegin "Stopping $name" 27 # Kill the main process and any child processes 28 pkill -P "$pid" 2>/dev/null 29 kill "$pid" 2>/dev/null 30 # Wait a bit for graceful shutdown 31 sleep 2 32 # Force kill if still running 33 if kill -0 "$pid" 2>/dev/null; then 34 kill -KILL "$pid" 2>/dev/null 35 fi 36 # Clean up the pidfile 37 rm -f "$pidfile" 38 eend $? 39 fi 40 }