Creating schedules

Use create schedule to create a schedule to execute shell commands at a time you specify.

Syntax

create schedule sched_name as ‘sched_time’ [set {on | off}] for exec ‘command

Parameter

Example

Example 1 Create “schedule1” in Windows that suspends the connection to the pubs2 database in the SYDNEY_DS data server at 12:00 p.m.every Monday and 12:00 p.m. on the 16th of every month:

  1. Create a text file, such as sql.txt that contains the actual Replication Server command line that you want to schedule. For example, sql.txt can contain

    suspend connection to SYDNEY_DS.pubs2
    go
    
  2. Create a batch file, such as suspend_conn.bat in Windows that contains isql and relevant parameters to run the command line in sql.txt. For example, suspend_conn.bat can contain:

    %SYBASE\OCS-15_0\bin\isql.exe -Usa -P -S SYDNEY_DS -I %SYBASE%\sql.ini -i %SYBASE%\REP-15_5\sched\sql.txt

  3. Create the schedule, “schedule1”:

    create schedule schedule1 as ‘0 12 16 * 1’ for exec
    ‘test.bat > c:\temp\test.out’
    go
    

Example 2 Create “schedule2” to execute the suspend_conn.sh script in UNIX that suspends the connection to the pubs2 database in the SYDNEY_DS data server every day at 8:17p.m.:

create schedule schedule2 as ‘17 20 * * *’ for exec
‘suspend_conn.sh’

Example 3 Create “schedule3” to execute the resume_conn.sh script that resumes the connection to the pubs2 database in the SYDNEY_DS data server every day at 7:15 AM:

create schedule schedule2 as '15 7 * * *' for exec
‘resume_conn.sh’