#! /bin/sh
# /etc/init.d/fishbowl_x
#

# Some things that run always
touch /var/lock/fishbowl_x

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script fishbowl_x "
    su -c "startx" - display&
    sleep 10
    su -c "DISPLAY=:0.0 xrandr -s 1280x1024" - display&
    sleep 5
    su -c "xscreensaver" - display&
    sleep 5
    su -c "/home/display/get_song_info" - display&
    sleep 3
    su -c "xscreensaver-command -lock" - display&
    ;;
  stop)
    echo "Stopping script fishbowl_x"
    killall get_song_info;
    killall X;
    rm /var/lock/fishbowl_x;
    ;;
  *)
    echo "Usage: /etc/init.d/fishbowl_x {start|stop}"
    exit 1
    ;;
esac

exit 0
