manskemachine
Posts: 3
Joined: Wed Nov 06, 2013 3:49 am

First attempt at automating a program

Sat Dec 28, 2013 3:26 am

As a relative beginner to both Linux and the Raspberry Pi, I have found myself faced with the (seemingly) daunting challenge of writing my first shell script. In essence, all I would like my script to do is to boot the FileZilla FTP client upon start-up and have it properly shut down when the computer turns off.

Enclosed is the ramshackle script I've hacked together so far to the best of my ability. While I can run the script via the terminal and have it properly open and close the program, I've yet to be able to have my Raspberry Pi open the program automatically on start up. Having looked into this for some considerable time now, I fear that I am presently at my wit's end on the matter, and any help whatsoever on the matter would be greatly appreciated.

My Script (Registered via 'sudo update-rc.d filezilla defaults'):

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

### BEGIN INIT INFO
# Provides: filezilla
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO

# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting filezilla"
# run application you want to start
/usr/bin/filezilla
;;
stop)
echo "Stopping filezilla"
# kill application you want to stop
killall filezilla
;;
*)
echo "Usage: /etc/init.d/filezilla {start|stop}"
exit 1
;;
esac

exit 0

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: First attempt at automating a program

Sat Dec 28, 2013 4:10 am

I'm not the one to answer this, because I don't ever use a GUI (windowed) environment on my Pi, but I suspect that you do, and you expect that a GUI app like Filezilla is like any other process in Linux. But a GUI app needs a windowing environment to run in, and trying to start it before that GUI environment is started just won't work. I think each windowing environment (like Xwindows) has it's own method of starting apps once the GUI has been initialized. Rather than using init.d scripts, you'll need to figure out how the gui (Xwindows?) initializes programs like Filezilla.

Return to “Troubleshooting”