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

Whoops, forgot the probably most important one: mount

  • Comment on Re^6: Crontab "Can't open perl script", " No such file or directory"
  • Download Code

Replies are listed 'Best First'.
Re^7: Crontab "Can't open perl script", " No such file or directory"
by Anonymous Monk on Oct 09, 2014 at 20:50 UTC
    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

      The suggestions were meant to be placed in the crontab, but that doesn't matter anymore, since the problem has been discovered:

      /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)

      Yes, the home directory is encrypted, so it is not available when the user isn't logged in. One solution is to drop the scripts in a non-encrypted location (/opt or /usr/local or whatever suits your system) outside of the home directory and it'll work.

      $ sudo mkdir /opt/myscripts $ sudo chown myuser:myuser /opt/myscripts # put scripts in /opt/myscripts
        Crazy. I never would have guessed that one, I can move the scripts. Thank you all of the help!