Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Ubuntu deployed under regular tasks with crontab     - VMware Workstation virtual machine startup error: Could not open / dev / vmmon in CentOS 6 (Linux)

- Acquaintance C ++: the most simple C ++ program (Programming)

- Use Git in Eclipse (Linux)

- Linux security-related basics (Linux)

- Linux kernel TCP / IP parameters analysis and tuning (Linux)

- How MySQL tracking sql statement (Database)

- CentOS set up FTP server (Server)

- HashMap in Android and Java different implementations (Programming)

- Git Getting Started tutorial (Linux)

- How to find an IP address through the command line (Linux)

- Let CentOS6 yum upgrade to support more source rpm package (Linux)

- grub boot error resolution examples (Linux)

- Protect against network attacks using Linux system firewall (Linux)

- IP configuration under Linux (Linux)

- Linux memory management (Linux)

- Linux file permissions chmod chown (Linux)

- HBase Application Development Review and Summary of Series (Database)

- MySQL display operation control tips (Database)

- Some security configuration of Linux systems (Linux)

- CentOS 5.x install Lua 5.2.3 error (LIBS = -lncurses) (Linux)

 
         
  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:      
 
- CentOS 7 - use cgroups limit process resource (Linux)
- On the design of Oracle database backup (Database)
- Linux Operating System Security Study (Linux)
- Android graphic introduction NDK installation and simple jni demo implementation (Linux)
- CentOS7 set boot directly into the command line interface (Linux)
- Linux file compression and file system packaged with instructions (Linux)
- Automatic and Manual Proxy Settings Switch GNOME Shell Extension Proxy Switcher Recommend (Linux)
- Linux initialization init system - UpStart (Linux)
- Linux-du and df command (Linux)
- Java, extends and implements Usage (Programming)
- Linux /var/spool/ insufficient clientmqueue space solutions (Linux)
- The oh-my-zsh into true my zsh (Linux)
- When should I use Angular 2 (Programming)
- Linux kernel panic (because glibc result) Repair (Linux)
- Java Timer (regular calling, to achieve a fixed time to perform) (Programming)
- Linux network security probing tools Hping2 (Linux)
- Ubuntu How to install Pacman (Linux)
- Linux Defensive / mitigate DDOS attacks (Linux)
- CentOS6.x and Windows XP and Windows Server 2003 Open IPv6 related matters (Linux)
- Debian (Wheezy) Install Java environment / replace OpenJDK as the SUN JDK (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.