solip.de
Intel Channel Partner
Linksys reseller

Archive for the 'shell scripting' Category

Shell scripts, snippets and the like for Codee Bash, SH, and Co.

Cron / crontab structure

Created by Solip on 26 February 2010

Cron is used on Linux to run scheduled tasks. The configuration to be found in:

  • / Etc / crontab - system-wide
  • / Etc / cron.d
  • / Etc / cron.daily - daily call by crontab
  • / Etc / cron.hourly - called by crontab hourly
  • / Etc / cron - Monthly called by crontab
  • / Etc / cron.weekly - weekly call Duch crontab

Furthermore, can be stored per user, a separate crontab. To create a file with a cron job and does this by:

cron dateiname

The format of cron files:

Instruction to be executed *****
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ └ ─ ─ ─ ─ week (0-7) (Sunday = 0 or = 7)
│ │ │ └ ─ ─ ─ ─ ─ ─ month (1-12)
│ │ └ ─ ─ ─ ─ ─ ─ ─ ─ day (1-31)
│ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ hour (0-23)
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ minute (0-59)

The wildcard * can also be used.
Furthermore, as divider * / 2 - every 2nd Minute for example.
And areas such as 1-5 for weekdays as well.

In practice there is almost nothing that could withstand its schedule using cron.

Posted in Shell Scripting | No Comments »

Directories recursively without changing the content

Created by Solip on 11 February 2010

All directories recursively, eg chmod for new rights, but does not change the files in the directories.

So it goes with the shell:

find . -type d -exec chmod 755 {} \; -print

Posted in Shell Scripting | No Comments »