Tag:golangphppythonlinux
Article From:https://segmentfault.com/q/1010000012150353
Question:

crontab A job is performed to generate XML data, and the generated data permissions are all root, and the file permissions you want to generate are now WWW, and the previous scripts are like this:
30 06 * /opt/a > /dev/null 2>&1
To generate www permissions, as long as this:
30 06 * su – www /opt/a > /dev/null 2>&1 ?

Answer 0:

It’s not really good. After the file is generated, revise the ownership

Answer 1:

/2 * root /opt/a > /dev/null 2>&1

Answer 2:

30 06 * www /opt/a > /dev/null 2>&1 

Answer 3:

In addition to the planning task, the above plan is carried out, and another chown.

Answer 4:

crontabIt is aimed at users (each user has his own crontab), and your needs are cron (note no tab).

UbuntuThe words can be in/etc/cron.dNext to the new file (CentOS and other systems, please explore the same type), the format of the task is basically the same as the crontab, just before the command a specified user name to run the command. as

* * * * * user /path/to/file

userIt is to execute/path/to/fileThe user identity, if you want to run as root, is here.root

Reboot after saving the filecrondThe service is all right.

Link of this Article: Ask a question of crontab

Leave a Reply

Your email address will not be published. Required fields are marked *