perl - how to send input to a daemon in linux -


#!/bin/bash  . /etc/init.d/functions  name=foo dir=/home/amit/desktop exec=foo.pl pid_file=/var/run/foo.pid iexe=/etc/init.d/foo run_as=root  if [ ! -f $dir/$exec ]     echo "$dir/$exec not found."     exit fi  case "$1" in start)     echo -n "starting $name" cd $dir /home/amit/desktop/foo.pl     echo "$name running."     ;; stop) echo -n "stopping $name"     kill -term `cat $pid_file` rm $pid_file     echo "$name."     ;; force-reload|restart)     $0 stop     $0 start     ;;   submit)   echo $2 >> /tmp/jobs     ;;   *)     echo "use: /etc/init.d/$name {start|stop|restart|force-reload}"     exit 1   ;; esac exit 0 

i have created daemon start , stop options(service foo start/stop) , works fine. want send input dameon. "service foo submit [argument]" . want to know - if user types "service foo submit alexander" , how alexander can sent running daemon ?

if question right - use positional var $1 can supply rest of arguments command well, i.e.:

"your_start_up_script" [switch script $1] [arg 2 accessible via $2] [arg 3 accessible via $3]
inside script do:

     case "$1" in start)     echo -n "starting $name" cd $dir /home/amit/desktop/foo.pl   "$2"  "$3"  

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -