Sponsored Content
Full Discussion: Cron for an alternate sunday
Top Forums Shell Programming and Scripting Cron for an alternate sunday Post 302651585 by bakunin on Tuesday 5th of June 2012 08:59:20 PM
Old 06-05-2012
I always use the following construct for sensitive / dangerous operations. As i use ksh i use the "print"-builtin, you may want to change this to "echo" or whatever:


Code:
#!/bin/ksh

SIMULATE=""
# SIMULATE="print -"

...
$SIMULATE <potentially dangerous command>
...


In normal operation "$SIMULATE" evaluates to an empty string and the command just executes. If "SIMULATE" is set to its content like in the commented line then the command is printed instead of executing it.

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date - Last Sunday thru Saturday

Hi All, I have to kick off a script on every Monday to get some data from database for last week (Sunday thru Saturday). If its Monday (12/12/2005) Begin date will be Sunday - 12/4/2005 End date will be Saturday - 12/10/2005 The script might not kick off on some Mondays. So my... (2 Replies)
Discussion started by: skymirror
2 Replies

2. UNIX for Dummies Questions & Answers

Cron job -- to execute at every first Sunday of every month

Dear all How can I schedule the cronjob to be run sometime at every first Sunday at every month? I have the edit the cronjob every month now, thanks (2 Replies)
Discussion started by: shanemcmahon
2 Replies

3. Solaris

How to check for Saturday or Sunday

Hi , I have a date parameter passed in YYYYMMDD format , how can I check whether it is Sat or Sun on Solaris box , as we can do the same easily on linux box by using date -d YYYYMMDD '+a' . Any pointres will be really helpful . (5 Replies)
Discussion started by: harpreetanand
5 Replies

4. UNIX for Advanced & Expert Users

How to get the sunday days between two dates?

Hi Am using Unix Ksh I have a two date input as DATE1=02/12/2012 DATE2=30/12/2012 I Need the output as only sunday date 02/12/2012 09/12/2012 16/12/2012 23/12/2012 30/12/2012 can anyone pls help me.. thanks in advance... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

5. UNIX for Advanced & Expert Users

How to get the count of sunday between two dates?

Hi Am using unix Ksh I have the two dates DATE1=01/01/2013 DATE2=11/02/2013 In this two dates i need the output as count of sunday sunday=6 Can anyone help me pls!!! (1 Reply)
Discussion started by: Venkatesh1
1 Replies

6. Shell Programming and Scripting

Second sunday of March

Hi, I want to get the second Sunday of march in any year, I have tried below command but it is not giving me the correct output i_year=`date +%Y` cal -m 03 $i_year | sed '/^$/d' |head -4 |tail -1|rev | cut -c1` This is returning me 0 , where as I want 10. Can you please help Thanks (5 Replies)
Discussion started by: infyanurag
5 Replies

7. Shell Programming and Scripting

How to get first sunday of the month?

Hi, Please can someone help me in getting first sunday date of a month. i_year=`date +%Y` ny_first_sun_nov=`cal 10 $i_year | sed '/^$/d' |head -3 |tail -1| rev | cut -c1` This works good if the first sunday has a value but not if it is blank and first sunday falls on second week. ... (17 Replies)
Discussion started by: infyanurag
17 Replies

8. UNIX for Dummies Questions & Answers

Yesterday's Date if it is Sunday

Hi All, Can you please let me know how to get the yesterday's date of the given date if the given date is Sunday? I can't use GNU. I have the code to get the yesterday's date based on the system date. Thanks (5 Replies)
Discussion started by: shash
5 Replies

9. AIX

cron job on 3rd sunday of every month

Hi, Actually scheduled my test scripts on test severs as shown below. They are supposed to run on 3rd sunday of every month. Unfortunately it ran on 2nd sunday of the month (suspecting that it will run every sunday). I am sorry if I miss something. Could you please let me know if I did any... (1 Reply)
Discussion started by: System Admin 77
1 Replies
LIRCD(8)						  System Administration Utilities						  LIRCD(8)

NAME
lircd - LIRC daemon decodes infrared signals and provides them on a Unix domain socket. SYNOPSIS
lircd [options] [config-file] DESCRIPTION
The main task of lircd is to decode the infrared signals and provide an uniform interface for client applications. Clients can connect to lircd through a Unix domain socket which is located in var/run/lirc/lircd. Using this socket they will get the infrared codes received by lircd and they can send commands to lircd. -h --help display this message -v --version display version -n --nodaemon don't fork to background -p --permission=mode file permissions for /var/run/lirc/lircd -H --driver=driver use given driver -d --device=device read from given device -l --listen[=[address:]port] listen for network connections -c --connect=host[:port] connect to remote lircd server -o --output=socket output socket filename -P --pidfile=file daemon pid file -L --logfile=file daemon log file -r --release[=suffix] auto-generate release events -a --allow-simulate accept SIMULATE command -u --uinput generate Linux input events -R --repeat-max=limit allow at most this many repeats OPTIONS
The --permission option gives the file permission of var/run/lirc/lircd if it has to be created in octal representation. Read the documen- tation for chmod for further details. If no --permission option is given when the socket is initially created the default is to give all users read and write permissions (0666 in octal representation). If /var/run/lirc/lircd already exists this option has no effect. With the --device option you can select the character device which lircd should read from. The default currently is /dev/lirc but it proba- bly will change in future. If you're using the dev/input driver, you can use name=STRING or phys=STRING to select the device; lircd will look in /dev/input to find a device with a matching description. This is useful in case the device name isn't fixed. STRING may contain the '*' and '?' wildcards and '' to mark them as literal. With the --listen option you can let lircd listen for network connections on the given address/port. The default address is 0.0.0.0, which means that connections on all network interfaces will be accepted. The default port is 8765. No security checks are currently implemented. The listening lircd instance will send all IR events to the connecting lircd instances. The --connect option allows you to connect to other lircd servers that provide a network socket at the given host and port number. The num- ber of such connections is currently limited to 100. The connecting lircd instance will receive IR events from the lircd instance it con- nects to. With the --output option you can select Unix domain socket, which lircd will write remote key codes to. The default currently is var/run/lirc/lircd. With the --pidfile option you can select the lircd daemon pid file. The default currently is /var/run/lirc/lircd.pid. With the --logfile option you can select the lircd daemon log file. The default currently is /var/log/lircd. Note that this option will only be available if you compiled lircd without syslog support. The --release option enables automatic generation of release events for each button press. lircd will append the given suffix to the button name for each release event. If no suffix is given the default suffix is '_UP'. The --allow-simulate option will enable the SIMULATE command which can be issued using irsend(1). This will allow simulating arbitrary IR events from the command line. Use this option with caution because it will give all users with access to the lircd socket wide control over you system. E.g. if you have configured your system to shut down by a button press on your remote control, everybody will be able to shut down your system from the command line. On Linux systems the --uinput option will enable automatic generation of Linux input events. lircd will open /dev/input/uinput and inject key events to the Linux kernel. The key code depends on the name that was given a button in the lircd config file, e.g. if the button is named KEY_1, the '1' key code will be generated. You will find a complete list of possible button names in /usr/include/linux/input.h. The --repeat-max option sets an upper limit to the number of repeats when sending a signal. The current default is 600. A SEND_START request will repeat the signal this many times. Also, if the number of repeats in a SEND_ONCE request exceeds this number, it will be replaced by this number. FILES
The config file for lircd is located in /etc/lirc/lircd.conf. lircd has its own log file in /var/log/lircd (beginning with LIRC version 0.6.1 you can configure lircd to use syslogd for log messages; then it depends on your system configuration where log messages will show up). You can make lircd reread its config file and reopen its log file by sending the HUP signal to the program. That way you can rotate old log files. DAEMONS
lircd and lircmd are daemons. You should start them in some init script depending on your system. There are some example scripts for dif- ferent distributions in the contrib directory. lircmd has to be started after lircd as it connects to the socket lircd provides. If you start lircd or lircmd from your shell prompt you will usually get back immediately to the prompt. Often people think that the pro- gram has died. But this is not an error. lircd and lircmd are daemons. Daemons always run in background. SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd 0.9.0-pre1 October 2010 LIRCD(8)
All times are GMT -4. The time now is 08:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy