Comment on Prevent rsync cronjob to run multiple times via cronjob on Linux by hip0d.
Another way I just red on a blog is as follows:
$ crontab -l
* * * * * /path/to/cron.sh
The command above will, just as the first example, execute our PHP script every minute through a bash script. To prevent it from overlapping, it can also be changed to this.
$ crontab -l
* * * * * /usr/bin/pgrep -f /path/to/cron.sh > /dev/null 2> /dev/null || /path/to/cron.sh
The pgrep command will return false if it does not find a running process matching the first argument, /path/to/cron.sh. If it returns false, it'll process the second part of the OR comparison (the double vertical line, ||). If the running process was found, pgrep will return the Process ID (PID) and Bash will not continue to the second part of the OR statement since the first already returned true.
The trick here is to use very unique scriptnames. If the name is too generic (such as "cron.sh"), pgrep may return Process IDs from other running cron jobs and not execute the cron you wanted.
hip0d Also Commented
Prevent rsync cronjob to run multiple times via cronjob on Linux
Here is another life time example with flock:
*/5 * * * * /usr/bin/rsync –delete -a source_server:/source/path/ /dst/path/
Example using flock:
*/5 * * * * flock -xn /tmp/example.lock -c '/usr/bin/rsync –delete -a source_server:/source/path/ /dst/path/'
Recent Comments by hip0d
| backupsetname | Command line only. |
| class | Command line only. |
| dateformat | Client system options file (dsm.sys) or command line. |
| detail | Command line only. |
| dirsonly | Command line only. |
| filelist | Command line only. |
| filesonly | Command line only. |
| fromdate | Command line only. |
| fromowner | Command line only. |
| fromowner | Command line only. |
| fromtime | Command line only. |
| inactive | Command line only. |
| nasnodename | Client system options file (dsm.sys) or command line. |
| numberformat | Client user-options file (dsm.opt) or command line |
| pitdate | Command line only. |
| pittime | Command line only. |
| querysummary | Command line only. |
| scrolllines | Client user-options file (dsm.opt) or command line |
| scrollprompt | Client user-options file (dsm.opt) or command line |
| subdir | Client user-options file (dsm.opt) or command line |
| timeformat | Client user-options file (dsm.opt) or command line |
| todate | Command line only. |
| totime | Command line only. |
Examples
Task Display a list of all active and inactive backup versions of
your files in the current directory.
dsmc query backup -inactive "*"
Task Display a list of all your backups in the current directory.
Use the detail option to display the last modification date and
the last access date of each file.
dsmc q backup -detail "*"
Task Display a list of files that were backed up from the /home/proj
directory with file names that begin with proj.
dsmc q b "/home/proj/proj*"
Task Display a list of active and inactive backup file versions in
the /home file system.
dsmc q b -ina -su=yes /home/
Task Query file system images from the nas2 NAS file server.
dsmc query backup -nasnodename=nas2 -class=nas
Query NAS file system images
You can use the query backup command to display information about file
system images backed up for a NAS file server. Tivoli Storage Manager
prompts you for an administrator ID.
Where supported, use the nasnodename option to identify the NAS file
server to query. Place the nasnodename option in your client
system-options file (dsm.sys). The value in the client system-options
file is the default, but this value can be overridden on the command
line.
Use the class option to specify the class of the file space to query. To
display a list of images belonging to a NAS node, use the -class=nas
option.
IBM TSM dsmc console client use for listing configured backups, checking set scheduled backups and backup and restore operations howto
Supported Clients
This command is valid for all clients.
Syntax
>>-Query Backup–+————+–+- –filespec—+————-><
'- –options-' '- –"filespec"-'
Parameters
filespec
Specifies the path and file name that you want to query. Use wildcard
characters to specify a group of files or all the files in a
directory. If you use wildcard characters, enclose the file
specification in double quotation marks. Specify an asterisk (*) to
display information about backup versions for all of your files in
the current directory. Do not use wildcards characters when you query
NAS file system images with -class=nas option setting.
Query Backup
The query backup command displays a list of backup versions of your
files that are stored on the Tivoli Storage Manager, or that are inside
a backup set from the server when the backupsetname option is specified.
The command displays the following file information:
* File specification
* File size
* Backup date
* Whether the file is active or inactive
* The management class that is assigned to the file. Only the first 10
characters of the management class name are displayed.
If you use the detail option with the query backup command, the client
displays the following extra information:
* Last modification date
* Last file attributes (inode) change date
* Compression
* Encryption type
* Client-side data deduplication
* Whether the file is migrated or premigrated. A value of Yes means
that the file is migrated or premigrated. A value of No means that
the file is not migrated or premigrated.
What Tinyproxy Does Keep in Memory:
While it doesn’t cache, it does use in-memory buffers to temporarily hold data during transmission (standard for any proxy). This is not caching in the HTTP sense — it's transient and discarded immediately after serving the request.
Tinyproxy is caching in the server’s memory, so your statement is incorrect and the swear word doesn’t make it look intelligent.
Best







