GoormIDE container creates timed tasks

If the GoormIDE free container is not operated for 15 minutes, the container will be closed. After restarting the container, the IP and mapped port will change. In order to fix the problem that the container IP and port do not change, write a shell script to execute regularly!

Step 1: Create a Shell Script

1. Create a shell script file named test.sh
touch /workspace/mingdi/test.sh

2. Edit the shell script
vi /workspace/mingdi/test.sh

3. Give the script execution permission
chmod 777 /workspace/mingdi/test.sh

Step 2: Install crontab

1. Ubuntu installation:

apt-get install cron

2. Generate a configuration file:

crontab -e

Press Esc and enter: wq Enter

3. Check whether the installation is successful: crontab -l

4. Create a script to execute a scheduled task, edit the configuration file: crontab -e
to add a scheduled task, and execute the test.sh script under the /workspace/mingdi path every minute

* * * * * /workspace/mingdi/test.sh

5. Press Esc to save and exit

:wq

Basic commands:
Start: service cron start
Restart: service cron restart
Stop: service cron stop
Check status: service cron status
Query available commands for cron: service cron

Guess you like

Origin blog.csdn.net/edsoki/article/details/127330515