D
D
Demigodd2018-05-07 20:27:10
ubuntu
Demigodd, 2018-05-07 20:27:10

How to run custom script during Boot Process?

For example, I have a
script.sh script
inside → echo "hello world"
How can I make this script run after clicking on boot from Ubuntu in Grub, or during Init ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slesair, 2018-05-18
@Demigodd

I made a game server startup script like this:
Create a startup script
[email protected]:~$ nano ins-ds.sh
#!/bin/sh
cd /home/steam/ins-ds
prog="sudo -u steam ./srcds_run -cfg server.cfg -port 27015 +map market_coop -workshop"
${prog}
Make it executable
[email protected]:~$ chmod +x ins-ds.sh
Create an autostart service on server startup
[email protected]:~$ sudo nano /lib/ systemd/system/ins
[Unit]
Description=Insurgency Server
After=multi-user.target
[Service]
Type=idle
ExecStart=/home/steam/ins-ds.sh
[Install]
WantedBy=multi-user.target
edit launch rights
[email protected]:~$ sudo chmod 644 /lib/systemd/system/ins
Update configuration and enable script autorun
[email protected]:~$ sudo systemctl daemon-reload
[email protected]:~$ sudo systemctl enable ins

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question