10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to run a script from crontab but the entire script (which is 70+ lines) is written in bash and I need it to run from a certain directory.
So when I run it manually I cd to /local/mnt/scr and then type ./reordersc and it works fine.
However, I want it to run from the crontab and I... (20 Replies)
Discussion started by: newbie2010
20 Replies
2. Shell Programming and Scripting
Hi,
I want to write a script that does some sort of health check on the database. It will query the database for information, some query takes long and some are quick.
For example, inside the script I will do something as below:
#!/bin/ksh
run_query_01 &
run_query_02 &... (1 Reply)
Discussion started by: newbie_01
1 Replies
3. Shell Programming and Scripting
Dear all,
I wonder if it is possible that we can run the script
from time to time..I meant, it should repeat the
sourcing of the script by itself? In my case, I need
to source this script manually from time to time,
like once in every 10 minutes.
emily, (2 Replies)
Discussion started by: emily
2 Replies
4. Shell Programming and Scripting
Hi,
Do anybody experience to write a bash script in order to kill a specific process (java) after certain time of running?
eg.
java java.jar task_run.txt
I will run a java program (java.jar) which will run a long list of process (task_run.txt) one by one.
I plan to terminate the java... (5 Replies)
Discussion started by: perl_beginner
5 Replies
5. Shell Programming and Scripting
i want to make a script for grep any lines with key word and every time (5 min)
Ex. Log in Server.
.
.
.
03-01-2012 03:07:54,924 - INFO MessageUtil - Return | Status=0 | TxID=12010300000548755292 | Message=Success
03-01-2012 03:09:13,789 - INFO MessageUtil - Return | Status=0 |... (6 Replies)
Discussion started by: ooilinlove
6 Replies
6. Shell Programming and Scripting
Hi All,
newbie here, I'm just wondering how can i know the exact running time of my script?
Please advise,
THanks, (1 Reply)
Discussion started by: nikki1200
1 Replies
7. Shell Programming and Scripting
Unix Gurus,
I have a requirement where the shell script needs to do specific tasks after certain period of time.
Daily we receive few files in a particular folder. The script does the file renaming, pass parameters to run some web services and pushes to remote FTP location.
But my... (3 Replies)
Discussion started by: shankar1dada
3 Replies
8. Emergency UNIX and Linux Support
Dear Forum experts
I have the below script which I made to run under bash shell, it runs perfectly for low records number, let us say like 100000. when I put all records (3,000,000), it's takes hours
can you please suggest anything to optimize or to run in different way :-|
{OFS="|";... (6 Replies)
Discussion started by: yahyaaa
6 Replies
9. Shell Programming and Scripting
Hi
I have a script that performs a process on a file.
I want to know how to include a function to run a batch of files?
Here is my script
#!/bin/bash
#----------------------------------------------------------------------------------------------------------------------
#This... (2 Replies)
Discussion started by: ladyAnne
2 Replies
10. Shell Programming and Scripting
Hello Everybody..
I've written the script that kick off through CRON job and kill itself by specific time.
I've start time and end time specify in env file.
i.e
START_TIME=1500 (03:00 PM)
END_TIME=0600 (06:00 AM)
It always works good if my START_TIME is before midnight and my... (4 Replies)
Discussion started by: nirav_soni
4 Replies
ns_sched(3aolserver) AOLserver Built-In Commands ns_sched(3aolserver)
__________________________________________________________________________________________________________________________________________________
NAME
ns_after, ns_cancel, ns_pause, ns_resume, ns_schedule_daily, ns_schedule_proc, ns_schedule_weekly, ns_unschedule_proc - commands
SYNOPSIS
ns_after seconds {script | procname ?args?}
ns_cancel id
ns_pause id
ns_resume id
ns_schedule_daily ?-thread? ?-once? hour minute {script | procname ?args?}
ns_schedule_proc ?-thread? ?-once? interval {script | procname ?args?}
ns_schedule_weekly ?-thread? ?-once? day hour minute {script | procname ?args?}
ns_unschedule_proc id
_________________________________________________________________
DESCRIPTION
ns_after
run the specified script or procedure after the specified number of seconds
ns_after returns an id which can be used with the ns_pause, ns_cancel and ns_resume apis.
ns_cancel
stops the scheduled running of the id returned by an ns_after
returns 1 if unscheduled 0 if the script of procedure couldn't be unscheduled
ns_pause
pauses the scheduled running of the id returned by an ns_after
returns 1 if paused, 0 if the script of procedure couldn't be paused
ns_resume
resumes the scheduled running of the id returned by an ns_after
returns 1 if resumed, 0 if the script of procedure couldn't be resumed
ns_schedule_daily
ns_schedule_daily runs the specified Tcl script or procedure (procname) once a day at the time specified by hour and minute. The
hour can be from 0 to 23, and the minute can be from 0 to 59.
Specify -thread if you want a thread created to run the procedure. This will allow the scheduler to continue with other scheduled
procedures. Specifying -thread is appropriate in situations where the script will not return immediately, such as when the script
performs network activity.
Specify -once if you want the script to run only one time. The default is that the script will be re-scheduled after each time it is
run.
ns_schedule_daily returns an id number for the scheduled procedure that is needed to stop the scheduled procedure with ns_unsched-
ule_proc.
ns_schedule_proc
ns_schedule_proc runs the specified Tcl script or procedure (procname) at an interval specified by interval. The interval is the
number of seconds between runs of the script.
Specify -thread if you want a thread created to run the procedure. This will allow the scheduler to continue with other scheduled
procedures. Specifying -thread is appropriate in situations where the script will not return immediately, such as when the script
performs network activity.
Specify -once if you want the script to run only one time. The default is that the script will be re-scheduled after each time it is
run.
ns_schedule_proc returns an id number for the scheduled procedure that is needed to stop the scheduled procedure with ns_unsched-
ule_proc.
ns_schedule_weekly
ns_schedule_weekly runs the specified Tcl script or procedure (procname) once a week on the day specified by day and the time speci-
fied by hour and minute. The day can be from 0 to 6, where 0 represents Sunday. The hour can be from 0 to 23, and the minute can be
from 0 to 59.
Specify -thread if you want a thread created to run the procedure. This will allow the scheduler to continue with other scheduled
procedures. Specifying -thread is appropriate in situations where the script will not return immediately, such as when the script
performs network activity.
Specify -once if you want the script to run only one time. The default is that the script will be re-scheduled after each time it is
run.
ns_schedule_weekly returns an id number for the scheduled procedure that is needed to stop the scheduled procedure with ns_unsched-
ule_proc.
ns_unschedule_proc id
ns_unschedule_proc stops a scheduled procedure from executing anymore. The scheduled procedure to be stopped is identified by its
id, which was returned by the ns_schedule* function that was used to schedule the procedure.
EXAMPLES
ns_after ns_cancel ns_pause ns_resume
This example illustrates a web interface used to manage jobs. Depending on the action provided a job can be created, cancelled,
paused or resumed.
set action [ns_queryget action] set job [ns_queryget job] switch $action {
create {
set job [ns_after 10 [ns_queryget script]]
ns_puts "Job created with id: $job"
}
cancel {
if {[ns_cancel $job]} {
ns_puts "Job $job cancelled"
} else {
ns_puts "Job $job not cancelled"
}
}
pause {
if {[ns_pause $job]} {
ns_puts "Job $job paused"
} else {
ns_puts "Job $job not paused
}
}
resume {
if {[ns_resume $job]} {
ns_puts "Job $job resumed"
} else {
ns_puts "Job $job couldn't be resumed"
}
}
default {
ns_puts "Invalid action $action"
} }
ns_schedule_daily
This example defines a script called rolllog that uses ns_accesslog to roll the access log to a file with an extension containing
the current date. The ns_schedule_daily function is used to execute the rolllog script on a daily basis.
# Script to roll and rcp log file to host "grinder" proc rolllog {} {
set suffix [ns_strftime "%y-%m-%d"]
set new [ns_accesslog file].$suffix
ns_accesslog roll $new
exec rcp $new grinder:/logs/[file tail $new] } # Schedule "rolllog" to run at 3:30 am each morning ns_schedule_daily -thread 3
30 rolllog
ns_schedule_proc proc dosomething blah {
ns_log Notice "proc with arg '$blah'" } ns_schedule_proc 10 dosomething $arg1
SEE ALSO
KEYWORDS
schedule pause resume unschedule cancel after
AOLserver 4.0 ns_sched(3aolserver)