I need to have a script execute (bash or perl or php, any will do) another command and then exit, while the other command still runs and exits on its own. I could schedule via at command, but was curious if there was a easier way.
API to translate group name to group id (gid)
1:What scripts should not be ported from bash to python?
Similar constructs exists for perl and php, although in sh/bash its very easy to run ananother command in the background and proceed.. Vim + OmniCppComplete: Completing on Class Members which are STL containers edit. How do I bring a processes window to the foreground on X Windows? (C++) A very good source for generic process manipulation are all the start scripts under
#!/bin/sh your_cmd & echo "started your_cmd, now exiting!"
/etc/init.d. How communicate with pty via minicom or screen?They did all sorts of neat tricks such as keep track of pids, executing basic start/stop/restart commands etc.. Script to parse emails for attachments
To run a command in the background, you must append an '&' to the command.. If you need the program to last past your login session, you must use nohup.. See this similar stackoverflow discussion: how to run a command in the background ....
#!/usr/bin/bash # command1.sh: execute command2.sh and exit command2.sh &
I'm not entirely sure if this is what you are looking for, although you must background a process executed in a shell by appending the ampersand (&) symbol as the last character of the command.. So if you have script, a.sh. and a.sh needs to spawn a seperate process, like say execute the script b.sh, you'd:.
The usual way to run a command and have it keep running when you log out is to use
nohupprevents the given command from receiving the HUP signal when the shell exits. You also need to run in the background with the ampersand (&) command suffix..
$ nohup any _command arg1 arg2 &
So long as you mentioned Perl:.
...where "ls" is anything at all. Repeat for as many commands as you need to fire off..
fork || exec "ls";