3
###########################################################################
4
# Runs a command in the background without waiting for any output.
5
# Prints the pid of the command in stdout.
7
# Copyright (C) 2011 Alkis Georgopoulos <alkisg@gmail.com>
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
# On Debian GNU/Linux systems, the complete text of the GNU General
23
# Public License can be found in `/usr/share/common-licenses/GPL'.
24
###########################################################################
28
echo "Usage: $0 <command, file or URL>" >&2
31
1) # If there's only one parameter, it might be a file or URL
32
which -- "$1" >/dev/null || set "xdg-open" "$1"
36
# Do some logging, either in ~/.xsession-errors or on the console.
37
echo "$(LANG=C date '+%c'), epoptes-client executing: $@" >&2
39
# The command is ran with stdin and stdout descriptors redirected to /dev/null,
40
# so that it doesn't interfere with the output of other commands.
41
# stderr isn't changed, i.e. ~/.xsession-errors will be used.
42
"$@" 0</dev/null >/dev/null &