Prev: cutecom (probably a dumb question)
Next: Error Message: Firefox-3.6 under Linux ( Slackware-13 )
From: lora on 8 Feb 2010 16:35 Hello all, I've got the script below that I've placed in /etc/init.d and the appropriate soft link in the rc.d 5 directory. These scripts run as root after I do init 6. When this runs after I reboot the linux box, it's able to execute the part that dumps the contents of the environment variable $P4 to the snmTest file. However, it's not able to launch the myshell process. When the same script is run as root via the command line, it works fine. The same script runs fine when I do: sudo ./snmsrv What could be wrong? Thanks #!/bin/bash echo RSHServer if [ `id -u` -eq 0 ]; then echo "running as root" if ps aux | grep '[/]StartMenu/snmsrv.tcl' then echo "RSH Server already running...will not restart" else echo "Will restart RSH server..." su testuser -c ". ~testuser/.profile ; myshell & " su testuser -c ". ~testuser/.profile ; echo \$P4 >> ~testuser/snm Test ; myshell -cmd \"source \$P4/myscript.tcl \" & " fi else echo "Running in user mode. Skipping" fi
From: J.O. Aho on 8 Feb 2010 18:18 lora wrote: > I've got the script below that I've placed in /etc/init.d and the > appropriate soft link in the rc.d 5 directory. You should make a proper init script, which do support start/stop/restart/status, otherwise you can just add what you need to rc.local, which IMHO is a far better place than in a script placed in an init directory. > When this runs after I reboot the linux box, it's able to execute the > part that dumps the contents of the environment variable $P4 to the > snmTest file. > > However, it's not able to launch the myshell process. Is this a script/binary or an alias? An alias may not work that well. > su testuser -c ". ~testuser/.profile ; myshell & " do: su testuser - -c "myshell &" this way you get the testuser's environment variables at once instead of doing that each time you run the command. -- //Aho
From: Cat22 on 9 Feb 2010 03:11 lora wrote: > Hello all, > > I've got the script below that I've placed in /etc/init.d and the > appropriate soft link in the rc.d 5 directory. > > These scripts run as root after I do init 6. > > When this runs after I reboot the linux box, it's able to execute the > part that dumps the contents of the environment variable $P4 to the > snmTest file. > > However, it's not able to launch the myshell process. > > When the same script is run as root via the command line, it works > fine. > > The same script runs fine when I do: > sudo ./snmsrv > > What could be wrong? > > Thanks > > > > #!/bin/bash > echo RSHServer > > if [ `id -u` -eq 0 ]; then > > echo "running as root" > if ps aux | grep '[/]StartMenu/snmsrv.tcl' > then > echo "RSH Server already running...will not restart" > else > echo "Will restart RSH server..." > su testuser -c ". ~testuser/.profile ; myshell & " > su testuser -c ". ~testuser/.profile ; echo \$P4 >> > ~testuser/snm > Test ; myshell -cmd \"source \$P4/myscript.tcl \" & " > > fi > > else > echo "Running in user mode. Skipping" > > fi > I would add the full path to myshell and retry. do you see the echostatements output? if not, echo stuff to a file so you can later examine it to see what it did Cat22
From: Cat22 on 9 Feb 2010 20:52 I found your exact same post in comp.os.linux.development.apps please dont multi-post - crosspost instead thanks Cat22
|
Pages: 1 Prev: cutecom (probably a dumb question) Next: Error Message: Firefox-3.6 under Linux ( Slackware-13 ) |