Re: Script Question (solved)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 06, 2005 at 02:47:19PM -0500, Mike McGrath wrote:
> For any interested parties.  I got a tip to try out nohup again.  The
> problem I was having earlier is that nohup tries to create a file
> called "nohup.out".  Since I was sudo-ing to "tomcat" this was a
> problem because user tomcat did not have access to my user's home
> directories.  Here's the fix:
> 
> if [ $RESTART_TOMCAT -eq 1 ]then
>         cd /tmp
>         echo "- Startup Tomcat"
>         sudo -u tomcat nohup /opt/tomcat/bin/startup.sh
>         sudo -u tomcat rm nohup.out
> Fi
> echo "- Tailing CATALINA.OUT"
> tail -f /opt/tomcat/logs/catalina.out

Instead of bothering with the rm command, you can prevent nohup from
creating nohup.out by redirecting standard output somewhere other than
the terminal:

	nohup cmd >/dev/null 2>&1

However, that will prevent the user from seeing the information on the
terminal (obviously).  You can trick nohup and still see the information
by using the tee command:

	nohup cmd | tee 2>&1

-chris


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux