宝塔计划任务(以指定用户运行命令)

Administrator 432 2022-07-19
su -c " {你要执行的命令} " -s /bin/sh 使用的用户

示例:

su -c " echo '========OneDrive-123========' &>> /www/backup/log.txt " -s /bin/sh 875
su -c " rclone -v sync /www/backup/ 123:/123/backup &>> /www/backup/log.txt " -s /bin/sh 875
su -c " echo '========OneDrive-123========' &>> /www/backup/log.txt;rclone -v sync /www/backup/ 123:/123/backup &>> /www/backup/log.txt " -s /bin/sh 875


su -c " echo '========Aliyun========' &>> /www/backup/log.txt " -s /bin/sh 875
su -c " rclone -v sync /www/backup/ aliyun:/vpsbackup/backup &>> /www/backup/log.txt " -s /bin/sh 875
su -c " echo '========Aliyun========' &>> /www/backup/log.txt;rclone -v sync /www/backup/ aliyun:/vpsbackup/backup &>> /www/backup/log.txt " -s /bin/sh 875