1. /opt/test.sh
#!/bin/sh
cd /opt
java -jar test.jar
echo "1">>test.txt
// every morning at 6:00
2.crontab -e
0 6 * * * /opt/test.sh
ps: If you use ssh remote client connection, you will not see the effect. The effect can only be seen through test.txt.