New answers tagged

2

You have already found that your problem is the interaction between set -e and the grep that did not match anything. You can tack on || true to avoid that, but see below. Instead of counting the lines in the file, you could simply test if there is anything at all in the file: if [ -s "TABLE_CHECKS" ] ; then NEW_TABLE_CHECKS=table_checks-`date +%Y-%m-%...


2

Terminate your awk statement and always use proper quoting when using bash. Finally, "[" as test is for the Bourne Shell sh; use "[[" when writing Bourne-Again Shell (bash) scripts. Grep expressions may not work the same way on all systems. I've tried to make yours more generic. #!/bin/bash -x # don't set flags unless you know you need 'em. # # Routine ...


0

You're trying to compare array to init value which is odd. You should print $load2 variable and see what contains.


0

I'm not familiar with duplicity, but your description about difference between running the script in terminal and by cron would suggest that tasks run by cron could be using a different interpreter. Try adding the following line to the very start of your script file. #!/bin/sh


0

A common reason for things that don't work in cron, but do work in a shell session is a difference of environment. Compare the output of the env when run from cron versus the shell. Recall that a shell launched from cron is non-interactive, which could result in differences in how your init scripts provision your environment.


0

It works for me */5 * * * * screen -dmS ftp-getter /bin/bash /home/user/ftp-getter.sh >> /var/log/ftp-getter.log 2>&1


2

It seems that you want the exit value from the remote script ( $?) and not stdout (the scripts output as per your title) The ssh man page says this ssh exits with the exit status of the remote command or with 255 if an error occurred. So if your script is working correctly it will return 100. If it's not then there are a few possibilities command ...


0

Fixed. The trouble is that $! is expanded too early. So escaping it delayed the expansion su - $USER -c "nohup java $rest_api_opts -jar $app_home/$app_name \ > /dev/null 2>&1& echo \$! > $PID"


0

As maxmlnkn answer states, you need a mechanism to setup/launch the appropriate Spark daemons in a Slurm allocation before a Spark jar can be executed via spark-submit. Several scripts/systems to do this setup for you have been developed. The answer you linked above mentions Magpie @ https://github.com/LLNL/magpie (full disclosure: I'm the developer/...



Top 50 recent answers are included