daemon (1030B)
1 #!/bin/sh 2 # 3 # Copyright (c) 2016 Dyne.org Foundation 4 # coffin is written and maintained by Ivan J. <parazyd@dyne.org> 5 # 6 # This file is part of coffin 7 # 8 # This source code is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU General Public License as published by 10 # the Free Software Foundation, either version 3 of the License, or 11 # (at your option) any later version. 12 # 13 # This software is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU General Public License for more details. 17 # 18 # You should have received a copy of the GNU General Public License 19 # along with this source code. If not, see <http://www.gnu.org/licenses/>. 20 21 ## this script tries to emulate the behaviour of bsd daemon(3) call 22 ## runs a job with its std streams closed and detaches from terminal 23 24 if test -z $1; then 25 echo usage: $(basename $0) job && exit 1 26 fi 27 28 (exec "$@" &) > /dev/null 2>&1