in reply to Re^3: Crontab "Can't open perl script", " No such file or directory"
in thread Crontab "Can't open perl script", " No such file or directory"

successful execution manually:
:~$ bash -l -c '/usr/bin/perl /home/myuser/scripts/perl/flash.pl' running for: 2014-10-08 get, success 148847 bytes of data. Number of rows affected: 0 :~$ /usr/bin/perl /home/myuser/scripts/perl/flash.pl running for: 2014-10-08 get, success 148847 bytes of data. Number of rows affected: 0 :~/scripts/perl$ ./flash.pl running for: 2014-10-08 get, success 148847 bytes of data. Number of rows affected: 0
  • Comment on Re^4: Crontab "Can't open perl script", " No such file or directory"
  • Download Code

Replies are listed 'Best First'.
Re^5: Crontab "Can't open perl script", " No such file or directory"
by Anonymous Monk on Oct 09, 2014 at 20:36 UTC

    Strange. Just some debugging ideas: what happens when running the following commands from the crontab:

    • ls -l /home/myuser/scripts/perl/
    • ls -l /usr/bin/perl
    • file /home/myuser/scripts/perl/flash.pl
    • head /home/myuser/scripts/perl/flash.pl
    • /usr/bin/perl -le 'print "Hello, World"'

      Whoops, forgot the probably most important one: mount

        Maybe the home directory is encrypted? I don't really know.
        :~/scripts/perl$ mount /dev/sda1 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) tmpfs on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mo +de=0755) none on /sys/fs/pstore type pstore (rw) systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev, +none,name=systemd) /home/myuser/.Private on /home/myuser type ecryptfs (ecryptfs_check_de +v_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs +,ecryptfs_sig=cdf62344e76957d1,ecryptfs_fnek_sig=88d715cd172f27b9) :~/scripts/perl$ ls -l /home/myuser/scripts/perl/ total 248 -rwxr-xr-x 1 myuser myuser 5962 Jul 10 15:16 flash.pl -rwxr-xr-x 1 myuser myuser 5962 Jul 10 15:16 flash2.pl -rwxrwxrwx 1 root root 183 Jul 10 14:54 asdf.pl drwxrwxr-x 2 myuser myuser 90112 Oct 9 11:04 flash :~/scripts/perl$ ls -l /usr/bin/perl -rwxr-xr-x 2 root root 10416 Mar 27 2014 /usr/bin/perl :~/scripts/perl$ file /home/myuser/scripts/perl/flash.pl /home/myuser/scripts/perl/flash.pl: Perl script, ASCII text executable +, with very long lines :~/scripts/perl$ head /home/myuser/scripts/perl/flash.pl #!/usr/bin/perl use warnings; use strict; use DateTime; use LWP::UserAgent; use Data::Dumper; use DBI; #Get yesterdays Date :~/scripts/perl$ /usr/bin/perl -le 'print "Hello, World"' Hello, World