LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running process as background -- without output (https://www.linuxquestions.org/questions/linux-newbie-8/running-process-as-background-without-output-907138/)

nathanjell 10-08-2011 02:38 PM

Running process as background -- without output
 
Ok so I'm running Fedora 15, and want to run a command at startup. To do this, I think I'll use cron, and configure the task through gnome-schedule. The command I wish to run is deluge-web.

So in short, I want to run the command without having to have the shell open, and without having any output. I really have no idea what to do. I've tried running

Code:

deluge-web&
but it still brings up the shell. It's not like there's any output anyways. I'm also thinking of maybe writing a simple sh/zsh script to run at startup through cron.

Any ideas on how to do this?

David the H. 10-09-2011 12:13 AM

cron is really there for running short-term commands regularly at specified intervals, and isn't really designed for autostarting programs. I'd think you'd be better off simply writing a start-up wrapper script and use your desktop's autostart feature to launch it.

As for running it silently, the wrapper script will act as the shell, so you probably won't get any console window. And error messages can be redirected away in any case.

Code:

#!/bin/bash

deluge-web "$@" 2>/dev/null &

exit 0

The $@ will allow you to pass any options to the program through the script's command line, should you need it.

nathanjell 10-09-2011 12:23 AM

This looks really good, I think it should work. I just want to start Deluge at startup, but don't want the whole program open, you know?

Ayway, do you know of a good startup manager? Fedora 15 (to my knowledge) doesn't include one at all, which is why I was using cron. I know back in the Ubuntu based realm, most if not all have one included. Which is why I'm surprised when I look everywhere for the startup manager in FC15!!! I though Fedora was more geared towards the workstations and servers the way Debian is, so you'd think it should have one included.

Edit:
Sorry about that, I should have googled more. Figured that out, now just to try out the script. I guess Fedora does come with gnome-session-properties, just no icon.

nathanjell 10-09-2011 11:42 AM

Looks good!
 
Tried out the script, and it looks like everything is good. I think the last thing I'll do is, just for fun, instead of redirecting stderr to /dev/null, maybe I'll redirect stdout and stderr to a log files, just cause I'd like to see what was going on if there was an error. Thanks for the help!


All times are GMT -5. The time now is 07:38 AM.