simple question:
10 4 * * * rm -rf ~/code/rehlds/build/ && ~/code/rehlds/build.sh --compiler=gcc --jobs=4 > /dev/null 2>&1
I checked an there is no /build folder which indicates that the build.sh did not execute.
crontab -e
10 4 * * * rm -rf ~/code/rehlds/build/ && ~/code/rehlds/build.sh --compiler=gcc --jobs=4 > /dev/null 2>&1
pgrep cron 658 1232359
so here I can see it was run
sudo grep CRON /var/log/syslog
Dec 8 04:10:01 xxxx CRON[1190963]: (xxx) CMD (rm -rf ~/code/rehlds/build/ && ~/code/rehlds/build.sh --compiler=gcc --jobs=4 > /dev/null 2>&1)
my job ran, but no compiling, that cronlog file is empty.
CMD (./code/rehlds/build.sh --compiler=gcc --jobs=4 &> ./cronlog)
답변1
if you work with 2 bash session, you must not only save the file with nano, but close it, only then is the crontab added.
when executing the build.sh I must first cd into that directory otherwise error:
$ ./code/rehlds/build.sh --compiler=gcc --jobs=4 CMake Error: The source directory "/home/cs2" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. make: *** No targets specified and no makefile found. Stop.
I found that out by manually executing this command
correct command:
10 4 * * * cd ./code/rehlds && rm -rf ./build && ./build.sh --compiler=gcc --jobs=4 > /dev/null 2>&1