In an AWS EC2 serverm, OS: amzn2-ami-kernel-5.10 x86_64
Trying to diagnose an issue of a slow running cron script, identified a single line of command that took more than an hour to run, everyday.
mysql --login-path=something -DdDB --quick --skip-column-names --batch -e "set @var1=${VAR1}; set @var2='${VAR2}'; source sql.sql;" | tr '\t' ',' | tr -d '|' | sed 's/$/\r/' | sed 's/\\\\N/\\N/g' > "/mnt/somepath" however when running the exact same command, with the same account that runs the script, it took no more than 10 seconds.
Is there any possible cause for this to happen? where a command takes much longer to run from a script triggered by crontab than from command line?