查看某个用户的crontab任务
crontab -l -u username
变更用户组来执行脚本的命令,超级用户除外,需要键入该使用者的密码。
su [-fmp] [-c command] [-s shell] [–help] [–version] [-] [USER [ARG]] #案例 su -c " #!/bin/bash cd /data/wwwroot/www.teenmay.cn/teenmay-api && /usr/local/php/bin/php /data/wwwroot/www.teenmay.cn/teenmay-api/artisan schedule:run >> /dev/null 2>&1 " -s /bin/sh www #可切换到对应的用户下执行脚本,环境变量不变



