marvvin

[archived] IRC bot
git clone https://hhvn.uk/marvvin
git clone git://hhvn.uk/marvvin
Log | Files | Refs | README | LICENSE

ctl.rc (412B)


      1 #!/bin/rc
      2 
      3 cd `{dirname $0}
      4 
      5 fn needsv {
      6 	if (!~ `{id -u} 0) {
      7 		printf 'You need root to start/stop services..'
      8 		exit 1
      9 	}
     10 	sv $1 marvvin
     11 }
     12 
     13 switch ($1) {
     14 case start
     15 	needsv start
     16 case quit
     17 	shift
     18 	printf 'QUIT :%s\r\n' $^* > ./input.fifo
     19 	needsv stop
     20 case join
     21 	shift
     22 	for (c in $*) {
     23 		printf 'JOIN %s\r\n' $c > ./input.fifo
     24 	}
     25 case part
     26 	shift
     27 	for (c in $*) {
     28 		printf 'PART %s\r\n' $c > ./input.fifo
     29 	}
     30 }