slitaz-forge view tank/files/etc/init.d/shellinabox @ rev 36

tank: Add shellinabox files.
author Christopher Rogers <slaxemulator@gmail.com>
date Wed Mar 16 15:35:15 2011 +0000 (2011-03-16)
parents
children 0900646fc6da
line source
1 #!/bin/sh
3 services="/"
5 mkexe()
6 {
7 exe=$0
8 while true; do
9 cd $(dirname $exe)
10 exe=$(basename $exe)
11 [ -L $exe ] || break
12 exe=$(readlink $exe)
13 done
14 echo $(pwd)/$exe
15 }
16 exe=$(mkexe)
18 services_arg()
19 {
20 for i in $services ; do
21 echo -n "-s '$i:conspy:conspy:/tmp:LINES=25 /bin/sh -c \"$exe service $i "
22 echo -n "\${peer} \${url} \${columns} \${lines}\"' "
23 done
24 }
26 pidfile=/var/run/shellinaboxd.pid
27 case "$1" in
28 service)
29 case "$2" in
30 /)
31 ulimit -t 60
32 exec /bin/nice -n 19 /usr/bin/conspy -f -v 0 ;;
33 esac
34 ;;
35 start)
36 if ! grep -q ^conspy: /etc/passwd; then
37 adduser -h /tmp -S -D -H conspy
38 addgroup conspy tty
39 fi
40 dir=$(dirname $exe)
41 eval shellinaboxd --background=$pidfile --disable-ssl \
42 --css=/usr/share/shellinabox/object.css \
43 --user-css 10px:-/usr/share/shellinabox/10px.css,12px:-/usr/share/shellinabox/12px.css,14px:-/usr/share/shellinabox/14px.css,16px:+/usr/share/shellinabox/16px.css \
44 -s /login:LOGIN $(services_arg)
45 ;;
46 stop)
47 [ -s $pidfile ] && kill $(cat $pidfile)
48 ;;
49 esac