https://www.vultr.com

The Everywhere Cloud

Deploy an instance.
Accelerate your application.


Running Linux Commands at Startup


The following procedure enables Linux programs to start automatically after booting, without requiring users to log in first. This method is useful when automating custom daemons to act as servers with user-specific privileges.

This can also be done on the FreeBSD crontab, with some slight changes to account for the behavior of other shells.

==========

1. Edit the user crontab file.

user@host: $ crontab -e

2. Add the @reboot line with the desired command.

# BEGIN CODE

@reboot /myfolder/mydaemon.sh > /dev/null 2>&1 &

# "> /dev/null" discards standard output by redirecting to the null device.
# "2>&1" redirects standard error to standard output.
# Terminating with "&" executes the command in the background.

# END CODE

3. Save and exit crontab, then reboot the machine.

==========

Comments

Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers