Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Ubuntu deployed under regular tasks with crontab     - Binary tree traversal recursive and non-recursive (cyclic) traversal achieve (Programming)

- Chkconfig set boot start under Linux (Linux)

- Use ARChon runtime environment to run Android apps on Ubuntu (Linux)

- N1QL bring SQL-like query NoSQL database experience (Database)

- OpenNMS separate database (Server)

- 30 minutes with your Quick Start MySQL Tutorial (Database)

- How to use jgit to manage Git submodule (Linux)

- A summary of Java multi-threaded programming - acquaintance multithreading (Programming)

- Axel install plug under CentOS 5/6 acceleration yum downloads (Linux)

- How to find the available network adapter on Ubuntu (Linux)

- Analysis of native Java keywords (Programming)

- Oracle bug Ora-04043 (Database)

- The Linux C truncate function clears the file notes (Programming)

- Python in os.path Magical (Programming)

- Hadoop 2.2.0 installation development environment (standalone pseudo-distributed mode) (Server)

- Oracle ordinary users show parameter method (Database)

- Linux operating system security settings initial understanding (Linux)

- 5 interesting Linux command line tips (Linux)

- Java coding conventions (Programming)

- C # C ++ Java interface type conversion (Programming)

 
         
  Ubuntu deployed under regular tasks with crontab
     
  Add Date : 2016-04-15      
         
         
         
  Use php to do a website, one of the statistics, we need to use the line every week. I wanted to see what way before other people see things, in general there are two ways, one is the php built-timed task with a system band, scheduled tasks under Windows Linux crontab and under.
Before using the php built-in timer task work can be found is simple to implement, in the middle there is no a lot of problems while doing time for ob_flush () and flush () and other functions are not very familiar with, and later saw some related article,
To which things have a deeper understanding. But later found after the php regular tasks on, seemingly can not stop, you do not need to restart the server down. You can not be resolved by modifying the php file.
Later, it intends to use the crontab Linux under to achieve. This time using Ubuntu to do the deployment system, nginx server to do. Crontab comes under this system, so do not install their own.
Open crontab log
  crontab by default not performed open day, so after a start to finish, can not perform, you want to see the log, but can not find. So the first task of opening timing of logs to see
  Modify rsyslog service the /etc/rsyslog.d/50-default.conf file before the # # cron * deleted; restart the rsyslog service with the following command:
service rsyslog restart;
  And then restart the crontab service:
service cron restart;
  Many people say the Internet open, stop or restart contab service with the command service crond restart, execute this command reported unrecognised service, where it crond cron into it.
  After that, in this position /var/log/cron.log can view the scheduled task log files files;
  The following command can also view the status of crontab
service cron status;
  Log File Viewer runtime execution if a statement appears in the log file:
  No MTA installed, discarding output
  When the crontab script execution is not directly output an error message, but will be sent as e-mail to the mailbox, you need a mail server, if not installed on the mail server, it will report the mistake.
  Each timer can be added later in the script:
> / Dev / null 2> & 1
  About to enter all the information into the linux system null device / dev / null in.
  To solve No MTA installed, discarding output problems.
Write regular tasks
  By the following command, you can turn on the user's time file, the file is stored in the folder / var / spool / cron / crontabs file
And to use the named file
crontab -e
  Through the following command to list the detailed contents of a user cron services
crontab -l
  I first wrote a timed test the following tasks using php to write a function, a write data to the database every minute, every minute timed task can be executed url
1 * * * * curl servername / Home / Test / test> / dev / null 2> & 1
  curl also comes with Ubuntu, without additional installation. This command at the command line alone is possible.
  Crontab can not seem to find the execution, later found to be written every minute, minute bits to be written * / 1, to perform the following is copied from others of several commands, but I have tried
Copy the code
Every five minutes the implementation * / 5 * * * *
Hourly 0 * * * *
00 performed per day * * *
0 * 0 * 0 performed weekly
Executive Monthly 001 * *
Executive 0011 per year *
Copy the code
  Before the final I can also run through the following commands are assigned to root privileges. But in my final run, I do not know this command has no effect. But still the first to write on. After running services need to restart the crontab
crontab -u root / var / spool / cron / crontabs / root
  When you can not run before you see a lot of people say the problem is not run environment variables need to be amended. But this time I did not encounter. But first down. The future may be used.
  I use the root user to write regular tasks, and you see others write the following content, try the next
  /etc/cron.deny that they can not use the crontab command
  /etc/cron.allow represents can use crontab users.
  If both files exist, then /etc/cron.allow priority.
  If neither file exists, only the super user can schedule the job.
     
         
         
         
  More:      
 
- Attic-- delete duplicate data backup program (Linux)
- 20 Advanced Java interview questions summary (Programming)
- Ubuntu 14.04, 13.10 install OpenCV 2.4.9 (Linux)
- Ftp user to create multiple virtual machines to support different access rights Examples (Server)
- Linux Monitoring Command (Linux)
- using the ssh command to check the socket / Network Connections (Linux)
- Python dictionary applications get built-in method (Programming)
- Dual system Linux (Ubuntu) into the Windows NTFS partition's mount error (Linux)
- build Android environment on Ubuntu 12.04 (Server)
- Android memory optimization of the disk cache (Linux)
- How to install and use the Snort in Ubuntu 15.04 (Linux)
- Java logging performance of those things (Programming)
- Fundamentals of the Java virtual machine memory management principles (Programming)
- How to use the character in C ++ without pressing the Enter key to enter the Show (Programming)
- MongoDB simple replication configuration (Database)
- CentOS7 complete step to install Hadoop2.7 (Server)
- To install Docker under CentOS7 (Linux)
- To install Docker under Ubuntu 15.04 (Linux)
- Oracle database on the hit rate of query summary (Database)
- OpenStack image production in the CentOS 6.2 (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.