我有 bash 脚本,它在 cron 中运行,并输出到文件。但是在我的脚本中,我正在运行另一个命令,该命令旨在输出到文件,但不输出到文件。
巴什
/opt/SP/php7/bin/php /var/httpd/domain/domain.com/scripts/cli-worker-manager.php processQueueAggregateFlows >> /var/httpd/domain/domain.com/scripts/logs/cli-worker-processQueueAggregateFlows.log 2>&1 &
# ps aux | grep cli-worker- | grep php | grep processQueueAggregateFlows
wwwadm 18141 0.0 0.1 456160 29524 ? S Mar05 0:08 /opt/SP/php7/bin/php /var/httpd/domain/domain.com/scripts/cli-worker-manager.php processQueueAggregateFlows
您可以>> /var/httpd/domain/domain.com/scripts/logs/cli-worker-processQueueAggregateFlows.log 2>&1
在查看时看到缺失ps
我运行的 cronjob 确实出现在ps
# ps aux | grep cli-worker- | grep "cli-worker-aggregateFlows.sh"
wwwadm 5620 0.0 0.0 117304 1752 ? Ss 15:19 0:00 /bin/sh -c . ~wwwadm/.bash_profile; /var/httpd/domain/domain.com/scripts/cli-worker-aggregateFlows.sh -e test >> /var/httpd/domain/domain.com/scripts/logs/cli-worker-processQueueAggregateFlows.log 2>&1