Hi I am using this code to upload a file on Linux from a bash script:
curl -F aok=2 -F Name='azko' -F dir="#path_to_file;filename=zou.odp"
-F "tag=1234" -F "OK=2" -F ecoTime=1 -F
-F ckx=no "http://blabla"
However the error I receive:
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
./up.sh: line 2: -F: command not found
./up.sh: line 3: -F: command not found
I have curl 7.47.0 installed.
So far I tried to put \ at the end of the lines but the error still keeps coming. What am I missing?
When I directly copy this code with \ placed to the terminal it works but this time gives another kind of error
curl: (43) A libcurl function was given a bad argument
I am guessing this is from a directory problem?
You are using -F -F without arguments.
Try:
curl -F aok=2 -F Name='azko' -F "dir=#path_to_file;filename=zou.odp" -F "tag=1234" -F "OK=2" -F ecoTime=1 -F ckx=no "http://blabla"
Also you have either write the whole command in one line (see above) or add \ to the end of the line if the command continues:
curl -F aok=2 -F Name='azko' -F "dir=#path_to_file;filename=zou.odp" \
-F "tag=1234" -F "OK=2" -F ecoTime=1 \
-F ckx=no "http://blabla"
Related
im trying to purge single url on cloudflare ,
this is my bash script
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 http://your.domain.com/url"
exit 0
fi
#get this from Account section in Cloudflare
TOKEN="SECRETTOKEN"
EMAIL="EMAIL"
DOMAIN="DOMAIN"
curl -s https://www.cloudflare.com/api_json.html \
-d "a=zone_file_purge" \
-d "tkn=$TOKEN" \
-d "email=$EMAIL" \
-d "z=$DOMAIN" \
-d "url=$1" >> test.log #output to check if this script work
and my php script
<?php
$domain = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
$actual_link = $_SERVER[HTTP_REFERER];
exec("/bin/bash /path/to/bkl.sh $actual_link");
echo "Success";
header('Refresh: 5; URL=' . $_SERVER['HTTP_REFERER']);
?>
method : i put a button on my website , so when user click on that button it will execute bash script on the server and purge the post url on cloudflare , and after that visitor will be redirect back to the post.
when i manually test bash script in my ssh it work perfectly and the test.log has result "SUCCESS"
but when i run php script on my website the test.log does not generate any output which mean its fail.
thank you hope someone can give me a better solution.
using
xls2csv -x /usr/share/nginx/html/price_list_EN.xls -s cp1252 -d 8859-1 > /usr/share/nginx/html/price_list_EN.csv
in linux commandline it works and exports it correctly, but if I use it on php
$transf2 = "xls2csv -x /usr/share/nginx/html/price_list_EN.xls -s cp1252 -d 8859-1 > /usr/share/nginx/html/price_list_EN.csv";
exec($transf2);
a file named price_list_EN.csv appears but it remains empty...
Try to execute your command like this from shell
su -s /bin/bash -c "xls2csv -x /usr/share/nginx/html/price_list_EN.xls -s cp1252 -d 8859-1 > /usr/share/nginx/html/price_list_EN.csv" www-data(your webserver user name)
then you debug the error
curl -H 'Authorization: Token token=<your_private_token>' -X POST
-F job[webapp_id]=2
-F job[param]=""
-F files[0]=#test.txt
-F files[1]=#test2.csv
-F job[file_url]="http://www.lirmm.fr/DEMAR/images/inria_corpo_rvb.jpg"
-F job[dataset]=<my_dataset_name> https://allgo.inria.fr/api/v1/jobs
I want to convert this into PHP cURL format. I have tried out something but it isn't working properly. Really would appreciate any help!
When i run the ffmpeg command directly in the command line it is working. But when i used the php command is breaking and getting error (At least one output file must be specified)
Code directly in command line
ffmpeg -i "F:/Sites/raaga_deploy36/mp4/arul/ghajini_rahath-96.mp4" -y -c copy -bsf h264_mp4toannexb -flags global_header -map 0 -f segment -segment_time 10 -segment_list "F:/Sites/raaga_deploy36/mp4/m3u8/ghajini_rahath-96.m3u8" -segment_format mpegts "F:/Sites/raaga_deploy36/mp4/m3u8/ghajini_rahath-96-segment_%05d.ts"
Code from PHP
$mfile=escapeshellarg($dir.$file);
$cfile=escapeshellarg($dir1.$fname.".m3u8");
$cfile_sg=escapeshellarg($dir1.$fname."-segment_%05d.ts");
$cmd="ffmpeg -i ".$mfile."-y -c copy -bsf h264_mp4toannexb -flags global_header -map 0 -f segment -segment_time 10 -segment_list ".$cfile.".m3u8 -segment_format mpegts ".$cfile_sg;
$res=shell_exec( $cmd );
Output in the command line
ffmpeg -i "C:/sites/hls/mp4/arul/ghajini_orum-128.mp4
"-y -c copy -bsf h264_mp4toannexb -flags global_header -map 0 -f segment -segmen
t_time 10 -segment_list "C:/sites/hls/mp4/m3u8/ghajini_orum-128.m3u8".m3u8 -segm
ent_format mpegts "C:/sites/hls/mp4/m3u8/ghajini_orum-128-segment_ 05d.ts"
since the commands (line) are breaking here it is not working.
please see the link below
http://dv.raaga.com/new_ig/m3u_convert_err.jpg
Thanks
Thanigaivelan
Currently I start an Armagetron Server with the following script
#!/bin/sh
tron="/home/duke/aa/bin/armagetronad-dedicated"
var="/home/duke/aa/servers/demo/var/"
log="${var}console_log.txt"
userconfigdir="/home/duke/aa/servers/demo/var/customize/config/"
parser="/home/duke/aa/scripts/parser.php"
ladderlog="${var}ladderlog.txt"
cmds="${var}cmd.txt"
tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
This runs the server and applys the php script in $parser
However, I want to start my server like this:
#!/bin/bash
screen -S $1 -X quit # avoiding to run the same server twice
screen -dmS $1 /home/duke/aa/scripts/srv $1
srv:
screen -S $1 -X logtstamp on
screen -S $1 -X logfile /home/duke/aa/servers/$1/logs
screen -S $1 -X log on
while true; do # start a loop to allow server restart if it crashes
/home/duke/aa/bin/armagetronad-dedicated --vardir /home/duke/aa/servers/$1/var --userdatadir /home/duke/aa/servers/$1/var/customize #run the server
echo "###Server has crashed. Ctrl-C to cancel reboot...###"
sleep 5
done # end the loop
the only problem here is I don't know how to specify a php parser to run on the server (im a noob). How would i modify the second scripts to allow this?
put all the code in your first block inside the while loop in the srv script, i.e.
srv:
#!/bin/bash
tron="/home/duke/aa/bin/armagetronad-dedicated"
var="/home/duke/aa/servers/demo/var/"
log="${var}console_log.txt"
userconfigdir="/home/duke/aa/servers/demo/var/customize/config/"
parser="/home/duke/aa/scripts/parser.php"
ladderlog="${var}ladderlog.txt"
cmds="${var}cmd.txt"
screen -S $1 -X logtstamp on
screen -S $1 -X logfile /home/duke/aa/servers/$1/logs
screen -S $1 -X log on
while true; do # start a loop to allow server restart if it crashes
tail -n0 -f -s 0.01 $ladderlog | $parser | $tron --userconfigdir $userconfigdir --vardir $var | tee -a $log
# /home/duke/aa/bin/armagetronad-dedicated --vardir /home/duke/aa/servers/$1/var --userdatadir /home/duke/aa/servers/$1/var/customize #run the server
echo "###Server has crashed. Ctrl-C to cancel reboot...###"
sleep 5
done # end the loop
(Does this look right?)
I hope this helps.