25 lines
737 B
Markdown
25 lines
737 B
Markdown
---
|
|
title: Run bash script on linux start
|
|
author: Max Gialanella
|
|
tags:
|
|
- bash
|
|
- linux
|
|
categories: []
|
|
date: 2023-09-10 18:26:00
|
|
---
|
|
|
|
Running a bash script on system start can be an involved process, depending on you distro. The proper way is to create a system service and plug it into /init.d but you can leverage the crontab if you want a simple quick way to run something on startup.
|
|
|
|
How to run a script on start up/reboot
|
|
Create Script
|
|
`cd` return to user home
|
|
`vim startup.sh` create script
|
|
`chmod +x startup.sh` Make script executable
|
|
`crontab -e` Edit crontab
|
|
|
|
Add the line
|
|
`@reboot sh $HOME/startup.sh`
|
|
|
|
Now your script will run on reboot.
|
|
[Source Stack overflow thread](https://stackoverflow.com/a/29247942)
|