What is the difference in running a process in background using start-stop-daemon with --background option and using with &?Which option is best and why?
start-stop-daemon with --background vs running using & option
2.5k views Asked by Prasad Roy At
2
There are 2 answers
0
Mark
On
I prefer the & option for making a background job. However, on the occasions that I forget to include the &, I use the Ctrl-Z command to stop the job and then enter bg to move the stopped command into the background.
While I have not observed any difference in the approaches (with the exception that & can be used in a script). A colleague of mine was very pleased to find out about the Ctrl-Z option of suspending a job. He claimed that he had some tasks where that "worked better".
If you want to learn more about Ctrl-Z and bg, look for bash job control.
Related Questions in LINUX
- Is there some way to use printf to print a horizontal list of decrementing hex digits in NASM assembly on Linux
- Why does Hugo generate different taxonomy-related HTML on different OS's?
- Writes in io_uring do not advance the file offset
- Why `set -o pipefail` gives different output even though the pipe is not failing
- what really controls the permissions: UID or eUID?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Docker container unable to make HTTPS requests to external API
- Whow to use callback_query_handler in Python 3.10
- Create kea runtime directory at startup in Yocto image
- Problem on CPU scheduling algorithms in OS
- How to copy files into the singularity sandbox?
- Android kernel error: undefined reference to `get_hw_version_platform'
- Is there a need for BPF Linux namespace?
- Error when trying to execute a binary compiled in a Kali Linux machine on an Ubuntu system
- Issue with launching application after updating ElectronJs to version 28.0.0 on Windows and Linux
Related Questions in SHELL
- macOS - Most secure way of a GUI SUDO_ASKPASS
- When does Bash read heredocs?
- Why `set -o pipefail` gives different output even though the pipe is not failing
- Run multiple shell scripts in Dockerfile
- Alias does not take effect when I use Vim to execute external commands
- why variable substitution is so different?
- Error: fish: ${ is not a valid variable in fish
- Custom Bash functions & custom statements - Need some advice
- unexpected operator == in square brackets when trying to use gum lib
- Delete first three lines containing a certain word
- Keep the log for the last 14 days
- Iterate over items in one array and groups of items in second array
- Keep multi-version of a static-lib like what we do for shared-libs
- How to write function in bash for reuse shell commands inside using osascript?
- Why is it that when I pass certain directory names to `ls`, sometimes it does not list their contents?
Related Questions in INIT.D
- Create kea runtime directory at startup in Yocto image
- Yocto init hangs on Banana Pi: How to debug?
- MySQL service not found
- What's the standard way to setup a debian package to be run as a service?
- Close starting service after opkg package install
- Monit / init.d for Elixir/Phoenix and Spinx/searchd on Ubuntu
- Failed to stop Apache Spark Master or Slave using Systemd
- How to convert systemv startup scripts to systemd services?
- Gradle still downloads dependencies already available in local repo
- how to autorun a shell script after boot - OpenWRT
- Why doesn't my process start at boot? (OpenWrt)
- How to autostart a C application for OpenWrt?
- Log output from service in /var/log/<service-name> (sysvinit)
- Authenticate a local Spring Boot service with Google Cloud
- Disable system logs for Spring Boot app running as Linux init.d service
Related Questions in START-STOP-DAEMON
- start-stop-daemon not running
- How to redirect the daemon output to pipe with BusyBox's start-stop-daemon?
- start-stop-daemon run with external script condition
- Do you know how to make the system automatically restart daemon service?
- Log output from service in /var/log/<service-name> (sysvinit)
- When Im running the android it starts emulator not physical device when react-native run-android
- start-stop-daemon with --background vs running using & option
- Gracefully shutdown a generic host in .NET Core 2 linux daemon
- why "systemctl" not working in Ubuntu terminal on Windows?
- Run Superset as Service
- How to troubleshoot services in Rapsberry Pi 3B
- start-stop-daemon error write to disk (some text)
- Can't read stdout output of external commands after deamonizing Python script
- Celeryd with django
- how to create a PID file for a java process
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
If you use
start-stop-daemon --backgroundthen start-stop-daemon will fork off a process to run in the background and then start-stop-daemon immediately exits. Among other things this means you can check the exit status of start-stop-daemon.If you use
start-stop-daemon &then the shell forks off a background process and runs start-stop-daemon in it. You won't be able to check its exit status as it won't actually exit (until the thing it runs exits).In most cases
start-stop-daemon --backgroundis a better choice.