Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a very simple one liner update_pot.sh

find . -iname "*.php" | xargs xgettext -olocale/messages.pot --from-code=UTF-8 -j

it works file if run ./update_pot.sh from prompt. but when i call from a cron job it returns

xgettext: no input file given
Try `xgettext --help' for more information.

I tried putting #! /bin/sh for the first line but no change.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

It is probably running from the wrong directory. Put a cd to the correct directory at the beginning of the script or change the find to use an absolute path.

share|improve this answer
1  
You could also change find . to find /path/to/starting/directory –  Iain Jan 20 '11 at 13:53
    
yes it was the path.I added a cd $(dirname $0) at the beginning. I purposely left the path . in the find so the the script which is part of a php application will work no matter where the whole directory is copied or moved. –  Grant M Jan 22 '11 at 4:57

I always try the same command with no environment like

env - find . -iname "*.php" | xargs xgettext -olocale/messages.pot --from-code=UTF-8 -j

but Cakemox is right - you should specify the path to find

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.