Syntax error near unexpected token `newline' in cPanel - linux

I am trying to back up my database in Laravel using Spatie package. Every thing worked fine till 31 Decemeber 2020 and in New Year my cron job stoped working. I don't know what happened, but on my cPanel mail I am receiving this email:
/usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token `newline'
/usr/local/cpanel/bin/jailshell: -c: line 0: `/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> '
and this is the cron job I am applying:
/usr/local/bin/php /home2/scoopscr/public_html/artisan backup:run 1>> /dev/null 2>&1

possible solutions
check your php version and php multimanager in cpanel both match or not
go to storage/log/laravel log read cron error
in any controller use
use Illuminate\Support\Facades\Artisan; Artisan::call('backup:run'); dd(Artisan::output());
now you can check your command working or not and able to find errors

Related

Error appending record to a file using echo

I want to write a record using execute command stage in Datastage sequence job.
I am using below syntax.
echo "InputFileName;2021-03-25 06:54:58+01:00;AAA;Batch;FOP;FUNCTIONAL;INFO;Extra key columns sent in Key Values;201;OK;SubmitRequest;ERROR;CDIER0961E: The REST step is unable to invoke the REST service, cause=javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated;;SupplyOnhand_20210325065458;;;;0;CDIER0961E: The REST step is unable to invoke the REST service, cause=javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated;;;;12;1;2021-03-25 05:55:18+00:00;2021-03-25 05:55:33+00:00" >> Filename
Below is error I am getting.
Output from command ====>
sh: -c: line 0: syntax error near unexpected token (' sh: -c: line 0: echo Unhandled failure (-1) encountered executing command echo
I tried running this manually on linux server its working there but failing in Datastage job.
Can someone please help.
You need to escape any character that is significant to the shell, or to contain the whole string in hard (single) quotes rather than soft (double) quotes.

after install ns2: syntax error near unexpected token 'You'

after install ns2 i meet this problem
IMPORTANT: command not found
bash: /home/tuanhoang/.bashrc: line 144: syntax error near unexpected token You'
bash: /home/tuanhoang/.bashrc: line 144:(1) You MUST put /home/tuanhoang/ns-allinone-2.35/otcl-1.14, /home/tuanhoang/ns-allinone-2.35/lib,
syntax error near unexpected token 'You'
I am using ubuntu 16.04. How can i solve this problem ? Thank all of you guys for your responds
This looks like some program has put a comment in your ~/.bashrc file without properly prefixing each line with #.
Read the comment in the file and follow its instruction. Then either remove it or comment it out properly by prefixing it with #.

I am skeptical about the redirection operation of below example

I was successful in redirecting the error message to a text file in the below process:
$ ls + 2>err.txt
$ cat err.txt
ls: cannot access +: No such file or directory
But when I try to attempt the same process with echo command it shows different output and unable to redirect the error message to a text file.
$ echo )hey 2>err.txt
bash: syntax error near unexpected token `)'
In your first example, it is the ls command that produces the error message that is written to err.txt.
In your second command, you are expecting the following to happen:
The line is successfully parsed
bash opens err.txt for the standard error of echo
echo tries to output )hey
echo encounters an error
The error message is written to err.txt.
However, bash never makes it past the first line, so none of 2 through 5 ever happens. Instead, the shell immediately stops processing the line and prints the error message to its own standard error.

Bash: Syntax Error Near Unexpected Token `(' When Using Wgrib2

Good Evening All,
I'm currently having a bash syntax issue when I try to run the following command in my terminal, the
bash: syntax error near unexpected token `('
error message pops up after I run the below code:
/mnt/grads/bin/wgrib2 /home/aaron/grads/data/sref_prob/20140530/15Z/sref.20140530.t15z.prob.grib2
-match ^(255|371|487|623|759|895|1031|1187|1343|1499|1655|1811|1967|2123|2279|2435|2591|2747|2903|3059|3215|3371|3527|3683|3839|3995|4151|4307):
-grib /home/aaron/grads/data/sref_prob/20140530/15Z/test.grib2
I realize that not many people on here probably have experience using wgrib2 but, this seems like a syntax error, not an issue with the program...
Parentheses and pipes have special meaning to the shell, you need to quote or escape them:
/mnt/grads/bin/wgrib2 /home/aaron/grads/data/sref_prob/20140530/15Z/sref.20140530.t15z.prob.grib2 \
-match '^(255|371|487|623|759|895|1031|1187|1343|1499|1655|1811|1967|2123|2279|2435|2591|2747|2903|3059|3215|3371|3527|3683|3839|3995|4151|4307):' \
-grib /home/aaron/grads/data/sref_prob/20140530/15Z/test.grib2

bashscript Heredoc + FTP error

I try to do this
#!/bin/bash
ftp "$HOST"$3"/"$2"/" <<EOD
#toggle Interactive mode
prompt off
lcd $5"/"$4
mget "$4"*
exit
EOD
I get the following error
syntax error: unexpected end of file
When I changed it to or any other possibility
ftp "$HOST"$3"/"$2"/" <<<EOD
#toggle Interactive mode
prompt off
lcd $5"/"$4
mget "$4"*
exit
EOD
I get
./download.sh: line 31: 87621 Segmentation fault: 11 ftp "$HOST"$3"/"$2"/" <<< EOD
./download.sh: line 20: prompt: command not found
./download.sh: line 21: lcd: command not found
./download.sh: line 22: mget: command not found
I am not sure how to fix this. What am I supposed to doooo O_O
On my Mac, the segmentation faults were produced by the comments in the script. Removing the lines with the trailing # would make it work.
many interactive commands don't really deal well with piped input. maybe try http://www.columbia.edu/kermit/ftpscripts.html ?
that said, many others seem to have had success doing what you're doing (e.g. http://www.unix.com/unix-advanced-expert-users/4189-automated-ftp.html ), so maybe you just have a quoting problem? try changing the command (ftp "$HOST"$3"/"$2"/") to just cat to see if the shell is properly passing there here-doc to it?
this, too, may lend insight if you end up needing to supply a password: http://www.stratigery.com/scripting.ftp.html

Resources