Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:26:26+00:00 2026-06-16T00:26:26+00:00

I am trying to schedule a job on a remote server. I want this

  • 0

I am trying to schedule a job on a remote server. I want this job to be scheduled either a minute from the current server time or a minute from the server time of the last scheduled job to run on the server. This way, no two jobs run at the same time (and thus race conditions are avoided).

The job scheduling is done with the at command on the remote (linux) server. I am forced to use at because I am running a bunch of complex simulations on several hosts that connect to the same server to request the next simulation (this part has been omitted from my question for brevity).

I am running into problems trying to schedule the job to run at a minute after the last scheduled job (or a minute from now if there are no scheduled jobs). My scheduler script currently looks like this:

minute=`atq | sort -t" " -k1 -nr | head -n1 | cut -d' ' -f4 | cut -d":" -f1,2`
curr=`date | cut -d' ' -f4 | cut -d':' -f1,2`

# the 'python -c" prints the correct scheduling time to stdout
cat <<EOF | at `python -c "import sys; hour,minute=map(int,max(sys.argv[1:]).split(':')); minute += 1; hour, minute = [(hour,minute), ((hour+1)%24,(minute+2)%60)][minute>=60]; print '%d:%02d'%(hour, minute)" "$minute" "$curr"`

python path/to/somescript "$1"

EOF

However, with this script, I get the following error:

somescript: 8: EOF: not found

However, if I were to hardcode the time as follows, that error disappears and the scheduling proceeds as expected:

minute=`atq | sort -t" " -k1 -nr | head -n1 | cut -d' ' -f4 | cut -d":" -f1,2`
curr=`date | cut -d' ' -f4 | cut -d':' -f1,2`

cat <<EOF | at 16:48 # or whatever other time

python path/to/somescript "$1"

EOF

I’d appreciate any help on how to fix this error as my entire setup goes bonkers as a result of this error.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:26:27+00:00Added an answer on June 16, 2026 at 12:26 am

    just a thought. instead of using the here doc why not create a temporary file and get rid of the EOF issue ?

    or do this :

    echo python path/to/somescript "$1" | at `python -c "import sys; hour,minute=map(int,max(sys.argv[1:]).split(':')); minute += 1; hour, minute = [(hour,minute), ((hour+1)%24,(minute+2)%60)][minute>=60]; print '%d:%02d'%(hour, minute)" "$minute" "$curr"`
    

    would get rid of the EOF, and maybe you could see the error better.

    I’m guessing the python code barfs on some weird condition, missing lead zero, am/pm, something that I just don’t see at the moment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run this script from the cron job schedule on Ubuntu Linux
I'm trying to run a scheduled job manually, the job looksa like this DBMS_SCHEDULER.CREATE_JOB
I'm trying to run a scheduled cron job using a crontab from a linux
I'm trying to schedule a repeating event to run every minute in Python 3.
I’m trying to send an email from a scheduled SQL Agent job using sp_send_dbmail
I am trying to schedule a job to run every 15 minutes on weekdays
Is it possible to run an SSIS package from a sql server agent job
I'm using SQL Server 2008 and trying to make schedule to run a page
I'm trying to schedule a job on a remote scheduler using the following code:
I am trying to schedule a Job in Autosys and I would like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.