Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Author: Alexander Winkler
- # http://www.dermute.de
- DESC="PyLoad Download-Manager"
- NAME="pyLoadCore.py"
- SHORT="pyload"
- DAEMON=/usr/share/pyload/$NAME
- DAEMON_ARGS=""
- INSTALL_DIR=/usr/share/
- UPDATE_SOURCE=https://bitbucket.org/spoob/pyload/get/tip.zip
- do_start()
- {
- echo "Starting $DESC ..."
- if [ -e $DAEMON ]; then
- if [ $(which screen) > /dev/null ]; then
- screen -dmS $SHORT $DAEMON
- echo "... successfully!"
- else
- echo "screen has not been installed correctly!"
- fi
- else
- echo "$DESC has not been installed correctly!"
- fi
- }
- do_stop()
- {
- $DAEMON -q
- }
- do_restart() {
- do_stop
- sleep 5
- do_start
- }
- do_update() {
- do_stop
- sleep 5
- cd $INSTALL_DIR
- wget $UPDATE_SOURCE
- unzip -o tip.zip
- rm tip.zip
- do_start
- }
- case "$1" in
- start)
- do_start
- ;;
- stop)
- do_stop
- ;;
- status)
- if [ $(pidof python $DAEMON) > /dev/null ]; then
- echo "$DESC is running."
- else
- echo "$DESC is NOT running."
- fi
- ;;
- restart)
- do_restart
- ;;
- watch)
- echo "Press CTRL+A D to stop watching and CTRL+C to kill $DESC."
- read -p "[Press any key to watch pyload now...]"
- screen -r $SHORT
- ;;
- update)
- do_update
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|watch}"
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement