0

How can I automatically run a .sh file right after I login with my regular credentials, and my root password. Thanks

Noah
  • 255

1 Answers1

0

ou can do that with a .desktop file placed in ~/.config/autostart. To create such a file simply do:

cat > ~/.config/autostart/myscript.desktop << "EOF"
[Desktop Entry]
Name=myscript.sh
GenericName=my script for foo-fu
Comment=does bar the foo or fu foos the bar
Exec=sh ~/scripts/myscript.sh
Terminal=true
Type=Script
Icon= 
Categories=Tools;
StartupNotify=true
EOF

Up to that make sure you have done a chmod 755 on that script by:

chmod 755 myscript.sh

and set it aswell to execute in nautilus like on the following example picture:

enter image description here

Videonauth
  • 33,355
  • 17
  • 105
  • 120
  • I could be wrong, but I think the original question was regarding pure command-line logins (not using X graphics at all). –  Apr 30 '16 at 23:28
  • If you call a script with preceding language, the script doesn't need to be executable. The .desktop file doen't need to be executable anyway, only if you use it as a double- click item on the desktop. – Jacob Vlijm May 01 '16 at 05:15