Hello everyone,
I’m fairly new to Proxmox, so I'm not entirely sure if it operates like other Linux systems or has its own peculiarities.
I have already created a VM, but my issue is that when I create a cron job to take a snapshot, it doesn't seem to execute properly. However, the syslog shows the following:
"
"
The snapshotVM.sh script looks like this:
"
"
The cron configuration is as follows:
"
"
"
Note that when I run the script manually, it executes successfully.
Can anyone help me figure out why the snapshot isn't being created by the cron job? Thank you very much!
I’m fairly new to Proxmox, so I'm not entirely sure if it operates like other Linux systems or has its own peculiarities.
I have already created a VM, but my issue is that when I create a cron job to take a snapshot, it doesn't seem to execute properly. However, the syslog shows the following:
"
Code:
Aug 20 12:00:01 sh3 CRON[312128]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Aug 20 12:00:01 sh3 CRON[312131]: (root) CMD (/root/script/snapshotVM.sh)
Aug 20 12:00:01 sh3 CRON[312128]: pam_unix(cron:session): session closed for user root
The snapshotVM.sh script looks like this:
"
Code:
#!/bin/bash
DATE=$(date +"%d-%m-%y_%H-%M-%S")
qm snapshot 100 VM_$DATE --vmstate 1 --description "Snapshot VM successful"
The cron configuration is as follows:
"
0 12 * * * /root/script/snapshotVM.sh"
#service cron status● cron.service - Regular background program processing daemon Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled) Active: active (running) since Tue 2024-08-20 07:55:12 EAT; 5h 38min ago Docs: man:cron(8) Main PID: 258315 (cron) Tasks: 1 (limit: 37782) Memory: 404.0K CPU: 60ms CGroup: /system.slice/cron.service └─258315 /usr/sbin/cron -fAug 20 11:17:01 sh3 CRON[290608]: pam_unix(cron:session): session closed for user rootAug 20 12:00:01 sh3 CRON[312128]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)Aug 20 12:00:01 sh3 CRON[312131]: (root) CMD (/root/script/snapshotVM.sh)Aug 20 12:00:01 sh3 CRON[312128]: pam_unix(cron:session): session closed for user root"
Note that when I run the script manually, it executes successfully.
Can anyone help me figure out why the snapshot isn't being created by the cron job? Thank you very much!