Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function usage
- {
- echo "usage nohup.bash command ..."
- exit 1
- }
- if (( $# == 0 )) ; then
- usage
- fi
- if [ ! -w . ] ; then
- echo "nohup.bash: the current working directory is not writable by you"
- exit 1
- fi
- logfile=` date +nohup.%Y%m%d.%H%M%S.$$.log `
- nohup /usr/bin/time $* > $logfile &
- bgpid=$!
- echo background process id is $bgpid
- sleep 1
- chmod go+r $logfile
- echo created file:
- echo $logfile
- if kill -0 $bgpid 2> /dev/null ; then
- echo background process $bgpid is running
- else
- echo background process $bgpid is not running
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement