diff --git a/README.md b/README.md index fdc2975..a4713c4 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,17 @@ Done!! Go to http://serverip and you should see the login screen. +### Alternative running novncd via runit +Alternative to running nonvcd via supervisor is runit. + +On Debian systems install runit and configure novncd service +``` +apt install runit runit-systemd +mkdir /etc/service/novncd/ +ln -s /srv/webvirtcloud/conf/runit/novncd.sh /etc/service/novncd/run +systemctl start runit.service +``` + ### Default credentials
login: admin diff --git a/conf/runit/novncd.sh b/conf/runit/novncd.sh index 99089d7..14b775b 100755 --- a/conf/runit/novncd.sh +++ b/conf/runit/novncd.sh @@ -1,4 +1,18 @@ #!/bin/sh + # `/sbin/setuser www-data` runs the given command as the user `www-data`. -cd /srv/webvirtcloud -exec /sbin/setuser www-data /srv/webvirtcloud/venv/bin/python /srv/webvirtcloud/console/novncd >> /var/log/novncd.log 2>&1 +RUNAS=`which setuser` +[ -z $RUNAS ] && RUNAS="`which sudo` -u" +USER=www-data + +DJANGO_PROJECT=/srv/webvirtcloud +PYTHON=$DJANGO_PROJECT/venv/bin/python +NOVNCD=$DJANGO_PROJECT/console/novncd + +# make novncd debug, verbose +#PARAMS="-d -v" + +LOG=/var/log/novncd.log + +cd $DJANGO_PROJECT +exec $RUNAS $USER $PYTHON $NOVNCD $PARAMS >> $LOG 2>&1