I can't figure out how to get output from shell script back to rtorrent after command has been executed.
Is it possible to return back output from exeternal command back to rtorrent session?
I use rtorrent scripting interface to auto execute shell command after torrent is finished
event line in .rtorrent.rc looks like this:
system.method.set_key = event.download.finished,mycustomcommand,"execute=~/myshellscript.sh"
myshellscript.sh file looks like this
#!/bin/sh
echo "Torrent finished!"
Is there a way to do this?
I'm not sure what you're searching for, but I found this on rtorrent's wiki site:
execute_capture_nothrow={command,arg1,arg2,...}
This will execute the external command with arguments arg1,arg2,.... It will return the
stdout output of the command.
system.method.set_key = event.download.finished,mycustomcommand,print="$execute_capture=/path/to/script"
should work, at least
print="$execute_capture=/path/to/script"
works when you do it inside rtorrent. If you want to store the output then intstead of print use d.custom1.set= if that helps.
You forgot to add parameters to the rtorrent.rc itself and also the bash script is incomplete according to me.
.rtorrent.rc line should have
method.set_key = event.download.finished,whatever,"execute2={/path/myscript.sh,$d.name=,$d.base_path=,$d.hash=}"
bash script
#!/bin/bash
TORRENT_NAME=1
TORRENT_PATH=2
TORRENT_HASH=3
touch "$1" Finished download!
exit
this will create touch file telling you particular file has finished downloading.
Related
I have a shell script that includes several commands.
For some of them, after it has been executed, I have to press P to quit the hint then the next command could proceed.
I want to know how to exit the hint automatically after the command gets executed, or input the keyword P automatically to exit it.
Thanks.
you can basically pipe it to cat just like following:
$ ./deploy_eb_dev.sh | cat
I have a bash script that do checks and show result correctly in local server
but when using graphic web of Centreon the message is empty
I use echo as output of function called from main
Thanks for all, the problem it is when i run script in Nagios-Centreon
i have this outpout NRPE: Unable to read output in OS AIX
the code is large, i resolve it by changing #!/bin/ksh instead of
#!/bin/bash
Basically the problem is because of special caracters in script shell.
https://support.nagios.com/kb/article/nrpe-nrpe-unable-to-read-output-620.html#:~:text=This%20error%20implies%20that%20NRPE,when%20running%20the%20remote%20plugin%20.
I have added Shell Script (in post build Task) which executes CURL statements.
The Curl statements gives some output which I want to refer later in my Shell Script, currently I am unable to achieve this.
Is there some way wherein it can be achieved.
I have searched for plugins but dint find any satisfactory answer to the requirement.
You can get the text as follows:
def proc = "<your culr command>".execute()
echo proc.in.text
You can use the shell syntax to capture this output:
curl_output=$(curl http://your.curl.query)
echo $curl_output
You will capture everything in your variable. Then you can use it whenever you want.
This is also working if you are calling a shell script:
output=$(./yourscript.sh)
echo $output
Your variable will catch everything that you echo during your execution
I'm writing a shell script. what it does is it will create a file by the input that is received from the user. Now, i want to add the feature called "view a file" for my current script. Now, it's unreasonal to retype it again since i've already had a script that helps
I know it's crazy when it is possible to it with normal shell command. I'm actually writing a script that help me to create pages that are generated from the touch command. (this pages had attached date, author name, subjects, and title).
The question is how to call a another script or inhere another script?
Couple of ways to do this. My prefered way is by using source
You can -
Call your other script with the source command (alias is .) like this: source /path/to/script.
Make the other script executable, add the #!/bin/bash line at the top, and the path where the file is to the $PATH environment variable. Then you can call it as a normal command.
Use the bash command to execute it: /bin/bash /path/to/script
I need a shell script using which I can fetch data from command prompt. I need to fetch data from the command prompt of a router. When I write commands in a shell script it goes the prompt but not executing the next command. So running the script just stuck in the prompt. Bellow is my script file
#!/bin/sh
ccli
rsc
where ccli is the command to enter the prompt and rsc is the command to fetch some infomation.
So please suggest some method.
If ccli reads commands from stdin (which I don't know), you might get further with
printf 'rsc\n' | ccli
For more complicated tasks I suggest you look into expect which was invented for the sole reason of driving interactive programs in a scripted way.