1

I have a cron job that runs every minute and makes a curl request and i have verified that using grep on the syslogs.

But the curl is not happening somehow and moreover i have a small echo statement in the cron that i log in some file.Even that log is not printing but manually when run my shell file it works.

Can someone help me out in this.?

Update : This is the shell file i am using

#This file sends the changed files to our server
#var=$(ls ~/Downloads | grep -v "^d")
#files=""
#for f in $(ls ~/OurDrive | grep -v ^d)
#       do
#               
#               files+="$f"","
#               
#       done 
files=()

cd /home/user/OurDrive
for file in *; do
    [[ -d $file ]] && continue
    files+=( "$file" )
done


comma_separated=$(IFS=,; echo "${files[*]}")
echo "$comma_separated" 
curl --data "file_list=$comma_separated&username=${USER}" http://localhost:8084/url/add.do
echo "done"> /home/user/Desktop/log.txt
0
3

Add a shebang line and explicitly use bash (on Ubuntu /bin/sh links to dash).

#!/usr/bin/env bash

or

#!/bin/bash

The first will search the environment for bash.

2
  • /bin/sh links to dash? How come? – jobin May 8 '14 at 19:56
  • 1
    @Jobin Click the link labeled dash. – Elliott Frisch May 8 '14 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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