Skip to content

Run bash commands on Startup

lhmerino edited this page Jul 30, 2019 · 3 revisions

Run bash commands and scripts on startup

What you need

  • Your script named "team_script"
    • This can be a custom script or the firewall rule script

Commands to run only once

  • echo -e '#!/bin/sh -e\n\n' > /etc/rc.local
  • chmod a+x /etc/rc.local

Commands to run for each script

  • echo -e '<path_to_script><team_script>\n\n' >> /etc/rc.local
    • Make sure to place a "/" between path_to_script and team_script
  • chmod a+x <path_to_script><team_script>
    • Make sure to place a "/" between path_to_script and team_script

Known Issues

If there are a series of commands and one of the commands returns an error, then any commands, if any, below the failed command will not execute. To resolve this issue use || true after each command when possible. For example:

  • echo hello || true
  • pct start 101 || true
  • pct mount 101 || true