From: Joe A. <jo...@bo...> - 2014-06-10 16:57:19
|
What OS/version are you on? The redhat/centos convention for service startup including running as a different user is via the *daemon* utility. There is a debian/ubuntu version also (start-stop-daemon). Of course, you will have to change any applicable root-permissioned files to the appropriate user before such a command will run successfully. But daemon is more reliable and coherent than su/sudo for this purpose. The form is like: daemon --user=myuser --pidfile=/path/to/my.pid my_command Defined in */etc/init.d/functions* --joe On Tue, Jun 10, 2014 at 9:20 AM, Osullivan L. <l.o...@sw...> wrote: > Hi Demian, > > Thanks for this - I'll give it a go. The standard script on the VuFind > Wiki works fine - it seems that attempting to start VuFind as a > different user to root causes the problem. > > Cheers, > > Luke > > On Tue, 2014-06-10 at 12:57 +0000, Demian Katz wrote: > > Those /dev/tty problems may be interfering. I think you can solve > > these by setting the JETTY_CONSOLE variable… e.g.: > > > > > > > > export JETTY_CONSOLE=/dev/null > > > > > > > > - Demian > > > > > > > > From: Osullivan L. [mailto:l.o...@sw...] > > Sent: Tuesday, June 10, 2014 5:35 AM > > To: vuf...@li... > > Subject: [VuFind-Tech] Starting / Stopping VuFind on Sever Start Up / > > Shutdown > > > > > > > > > > Hi Folks, > > > > I'm having a few problems with the automated start up and shutdown of > > VuFind on Ubuntu and was hoping someone may be able to spot any > > problems with my init script. > > > > #!/bin/sh > > ### BEGIN INIT INFO > > # Default-Start: 2 3 4 5 > > # Default-Stop: 0 1 6 > > # Description: VuFind init script > > ### END INIT INFO > > U=`id -nu` > > > > if [ $U != "root" ]; then > > echo "Script must be run from root. You are '$U'" > > exit 1 > > fi > > > > su -l cronfa -c "cd /usr/local/cronfa;./vufind.sh $* > > >> /var/log/cronfa/rc.log 2>&1" > > > > The init script works in that it calls start and stop routines are > > called and outputted to the rc.log file: > > > > Shutting down VuFind ... > > ./vufind.sh: 450: ./vufind.sh: cannot create /dev/tty: No such device > > or address > > Starting VuFind ... > > ./vufind.sh: 436: ./vufind.sh: cannot create /dev/tty: No such device > > or address > > /usr/lib/jvm/default-java/bin/java -server -d64 -Xms1024m -Xmx1024m > > -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+AggressiveOpts > > -XX:NewRatio=5 -Xloggc:/var/log/cronfa/gc.log > > -Dsolr.solr.home=/usr/local/cronfa/solr > > -Djetty.logs=/usr/local/cronfa/solr/jetty/logs > > -Djetty.home=/usr/local/cronfa/solr/jetty > > -jar /usr/local/cronfa/solr/jetty/start.jar > /usr/local/cronfa/solr/jetty/etc/jetty.xml > > VuFind running pid=928 > > sh: 1: cannot create /dev/tty: No such device or address > > > > However, when I restart the server, the Java process isn't actually > > running. I think it may being called to early / late because vufind.sh > > complains about /dev/tty not being available. At first, I thought the > > pid file wasn't being removed but it seems that although the script is > > reporting VuFind is running, sudo ps -e | grep "java" reveals that a > > java instance hasn't been started. > > > > Any help would be gratefully received! > > > > Thanks, > > > > Luke > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions > Find What Matters Most in Your Big Data with HPCC Systems > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data Exploration > http://p.sf.net/sfu/hpccsystems > _______________________________________________ > Vufind-tech mailing list > Vuf...@li... > https://lists.sourceforge.net/lists/listinfo/vufind-tech > |