Monday, July 26, 2021

Run script on startup in Ubuntu

Ctrl + Alt + T

cd /home/user/.config/

mkdir autostart


cd /home/user/.config/autostart

touch myscript.desktop


pico myscript.desktop

[Desktop Entry]

Name= myscript

Type=Application

Exec=/home/user/myscript/myscript.sh


chmod +x myscript.sh


reboot


ksysguard

Search myscript

OR

cd /home/user/myscript/


touch myscriptcheck.sh

#!/bin/sh


scripToTest="myscript.sh"

scriptExist=$(pgrep -f "$scripToTest")

[ -z "$scriptExist" ] && echo "$scripToTest : not running" || echo "$scripToTest : runnning"


chmod +x myscriptcheck.sh

./myscriptcheck.sh

No comments:

Post a Comment