-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustrunit.py
More file actions
executable file
·32 lines (20 loc) · 814 Bytes
/
justrunit.py
File metadata and controls
executable file
·32 lines (20 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
"""Runs a specified program, with any specified command-line arguments, in a
terminal, using nohup and redirecting stdout and stderr to /dev/null. That is,
it starts a program in a terminal, silencing its output and keeping it running
even if the terminal quits.
Usage:
%s [command line you want to run]
This script is copyright 2017-20 by Patrick Mooney. It is licensed under the GNU
GPL, either version 3 or (at your option) any later version. See the file
LICENSE.md for details.
"""
import subprocess
import sys
if len(sys.argv) <= 1:
print('\n\n' + __doc__ % sys.argv[0])
sys.exit(2)
if sys.argv[1] in ['-h', '--help']:
print('\n\n' + __doc__ % sys.argv[0])
sys.exit(0)
subprocess.call('nohup %s > /dev/null 2>&1 &' % ' '.join(sys.argv[1:]), shell=True)