WebFaction
Community site: login faq

I've got a script like this:

#!/bin/bash
kill $(cat ~/webapps/appname/pid)
sleep 5
~/webapps/appname/autostart.cgi

It works perfectly if I run it. But if I run it as a cron job, it doesn't kill the process and autostart.cgi crashes to give me a:

500 Internal Server Error

I'm using full pathnames in my script, so it isn't because it's not finding the pid or autostart.cgi files.

Anyone know why this is?

advTHANKSance

Robert

asked 03 Aug '16, 15:56

Robert Laing
113
accept rate: 0%


It is a good sign that it is working via the command line. I just tested something similar on a test account and it worked correctly. My thoughts are that your sleep is not long enough, however if you add the following to the end of your cron log it will show you the exact problem it encountered.

>> $HOME/logs/user/cron.log 2>&1

This will redirect stdout to $HOME/logs/user/cron.log, and redirect stderr to stdout (so that it will go to the same log). You can then check the log at $HOME/logs/user/cron.log to see the exact issue.

permanent link

answered 03 Aug '16, 19:15

aaront ♦♦
7664
accept rate: 27%

edited 03 Aug '16, 19:16

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×81
×32
×3

question asked: 03 Aug '16, 15:56

question was seen: 2,074 times

last updated: 03 Aug '16, 19:16

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM