init.d script samples

78 views
Skip to first unread message

Patrick Walters

unread,
Aug 9, 2014, 7:12:41 PM8/9/14
to web...@googlegroups.com
I'm setting up on a BeagleBone Black Rev C running Debian and following along with the book where I can.
I should mentions I installed web2py using apt-get and my Debian is Wheezy.

I never use the desktop on my BBB, so I want everything to work without GUI.
I was able to run web2py from the CLI and now I want to set it up to run as a service. The python-web2py in debian doesn't include the scripts directory (that I can find) so I grabbed https://github.com/web2py/web2py/blob/master/scripts/web2py.ubuntu.sh and modified it for debian replacing the 
DAEMON_DIR=/usr/lib/$NAME
with 
DAEMON_DIR=/usr/share/$NAME

when I run that /etc/init.d/web2py start I get all the same GTK errors when I try to run it from the CLI without specifying a password. So, just to try this out, I modified
DAEMON_ARGS="web2py.py --password=<recycle> --pid_filename=$PIDFILE"
to have ALL the CLI argument I passed when I was able to run it manually.
DAEMON_ARGS=("web2py.py --nogui -a 'password' -i 192.168.1.100 -p 8000 " +
"-c /usr/share/ssl-cert/server.crt -k /usr/share/ssl-cert/ssl/server.key" +
" --pid_filename=$PIDFILE")

I even added in --nogui for safe measure, but i'm still getting the GTK errors when I run /etc/init.d/web2py start.

Any suggestions or pointers for more information would be very helpful. 

Thanks,
-p

Patrick Walters

unread,
Aug 9, 2014, 10:33:58 PM8/9/14
to web...@googlegroups.com
I have made much progress on this since I posted and it got approved.

1) I was using python syntax in a bash script... :-) I removed the () and switched to single quotes.
DAEMON_ARGS='web2py.py -a "t3st3st" -i 192.168.1.20 -p 8000
-c /usr/share/ssl-cert/server.crt -k /usr/share/ssl-cert/server.key
--pid_filename=$PIDFILE'

2) the version of web2py in python-web2py from apt-get was old. I deleted /usr/sahrewb2py and then downloaded and copied web2py from github to /usr/share/web2py

It still fails when I try /etc/init.d/web2py start, but now I am at least getting useful errors.

root@bbbrevc:/# /etc/init.d/web2py status
web2py.service - LSB: web2py initscript
          Loaded: loaded (/etc/init.d/web2py)
          Active: failed (Result: exit-code) since Sat, 09 Aug 2014 16:27:38 -1000; 4min 40s ago
         Process: 4552 ExecStart=/etc/init.d/web2py start (code=exited, status=2/INVALIDARGUMENT)
          CGroup: name=systemd:/system/web2py.service

Aug 09 16:27:38 bbbrevc web2py[4552]: Starting Web Framework: web2pychown: ...y'
Aug 09 16:27:38 bbbrevc web2py[4552]: start-stop-daemon: user 'web2py' not found
Aug 09 16:27:38 bbbrevc web2py[4552]: failed!


Have to run out but I'll be back online in a few hours and back at this... if anyone has a suggestion still would love the help.

Thanks,
-p

Patrick Walters

unread,
Aug 10, 2014, 3:23:59 AM8/10/14
to web...@googlegroups.com
OK, for fun... I changed DAEMON_USER=web2py to root to see what would happen... 
I then ran /etc/init.d/web2py start. I was prompted for a password and the service started taking over the CLI as if I had launched it from the CLI directly.

root@beaglebone:/etc/init.d# web2py start
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)
WARNING:web2py:GUI not available because Tk library is not installed
choose a password:

please visit:
use "kill -SIGTERM 8504" to shutdown the web2py server



I'm officially back to stuck and could use some pointers.

Thanks,
-p
Reply all
Reply to author
Forward
0 new messages