Ubuntu boot auto-start settings

1. Create execution script

        There are two programs here, so I wrote two scripts, the first script (master.sh):

gnome-terminal -- bash -c "source /home/zyy/anaconda3/bin/activate wood2;cd /home/zyy/pycharmProject/master_program;python main.py > /home/zyy/pycharmProject/woodStart/masterLog.txt 2>&1 ;exec bash" &

        Open a new terminal, use the wood2 environment created by conda, go to the specified directory to execute the main.py program, and save the log information to the specified file masterLog.txt.

        The second script (wood.sh):

gnome-terminal -- bash -c "cd /home/zyy/pycharmProject/wood_master;/usr/bin/python3.6 vision_detector.py > /home/zyy/pycharmProject/woodStart/woodLog.txt 2>&1 ;exec bash" &

        Open a new terminal, go to the specified directory and use the python3.6 environment that comes with Ubuntu to execute the vision_detector.py program, and save the log information to the specified file woodLog.txt.

2. Grant script execution rights

        

sudo chmod 777 master.sh
sudo chmod 777 wood.sh

3. Start execution script settings

1. Run the gnome-session-properties command directly on the terminal to open the startup application preferences, as follows;

 2. Click the Add button, set the startup name, and click Browse to add the startup script file; you can restart the computer to see the effect.

Guess you like

Origin blog.csdn.net/qq_31112205/article/details/131759159