≡ Menu

hup

There is no rc.d script provided under OpenBSD for sshd service. How do I restart OpenSSH sshd server without rebooting OpenBSD 4.x server?
[click to continue…]

How to: Run a shell script with nohup command

Q. I'd like to run a command or shell script immune to hangups, with output to a non-tty or file. How do I use nohup command to run script called ~/utils/backup upload?

A. nohup is a Unix command that is used to run another command while suppressing the action of the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. It is most often used to run commands in background as daemons. Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected.

Run a script with nohup command

Type the command as follows to run a script called ~/utils/backup with 'upload' as argument to script:
$ nohup ~/utils/backup "upload" &

Q. How do I kill a process called inetd or foo and restart the same so that configuration file get updated?

A. Both UNIX and Linux supports POSIX reliable signals and POSIX real-time signals. Each signal has a current disposition, which determines how the process behaves when it is delivered the signal.

Generally following command is used
kill -1 process-pid

First get pid of inetd:
ps -e | grep inetd
Now force read inetd.conf:
kill -1 xinetd-pid

You can also use pkill command used to send signals. The pkill command allows the use of extended regular expression patterns and other matching criteria.
pkill -HUP process-name

Make syslog reread its configuration file
# pkill -HUP syslogd

Make xinetd reread its configuration file
# pkill -HUP inetd