I am trying to launch a script after a user has loged into the computer using the GUI. This script requires user input through the terminal. I have tried the following
.desktop file in ~/.config/autostart --> Does not work
When using this the output is not the same as that of the script running in the terminal. It closes the opened applications and vpn breaks the network connection. Neither of these occurr using the normal terminal.
My desktop enviroment is xubuntu version 20.04.
#!/bin/bash
echo "........ Start Up Script ........."
echo "sudo priveledges necessary for VPN"
#Connect VPN to Server in Czech Republic
sudo protonvpn c --cc CZ
#Prompt To Mount Encrypted Files
read -p 'Mount Encrypted Files? [ y/n ] ' encryptedmount
case $encryptedmount in
[Yy]* ) veracrypt -t -k "" --pim=0 --protect-hidden=no /media/peterthegreat/Main_Data/Files /media/veracrypt1; break;;
[Nn]* ) ;;
esac
Prompt To Update Packages
read -p 'Upgrade and Update System? [ y/n ] ' upgradeandupdate
case $upgradeandupdate in
[Yy]* ) apt-get update && apt-get upgrade; break;;
[Nn]* ) ;;
esac
#Prompt to Open Tilix
read -p 'Open Tilix? [ y/n ] ' til
case $til in
[Yy]* ) cd /home/peterthegreat; tilix --session=~/Documents/Start_Up/TilixSetup.json -e &;;
[Nn]* ) ;;
esac
disown %1
#Prompt to Open Firefox
read -p 'Open Firefox? [ y/n ] ' firefox
case $firefox in
[Yy]* ) firefox &;;
[Nn]* ) ;;
esac
disown %1
echo "....... Done ......."
Thanks
sudo
is supposed to be executed as root. You can imitate on the running terminal. I think a better explanation here https://askubuntu.com/questions/889632/startup-script-with-sudo-in-ubuntu-16-10 – Sadaharu Wakisaka Sep 08 '20 at 04:00[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=Start Up Comment=Set Up of Workspace Exec=/home/peterthegreat/Bash\\ Scripts/StartUp.sh OnlyShowIn=XFCE; RunHook=0 StartupNotify=false Terminal=true Hidden=false
– Billy Case Sep 08 '20 at 07:59StartUp.sh
into.bashrc
or something automatically loads and executes all inside a file when you get to login a desktop? – Sadaharu Wakisaka Sep 08 '20 at 22:27