add torrent to transmission from cron - transmission

I'm trying to add torrents to transmission from python. The code is shown below...
def download_movie(magnet_link):
os.system('transmission-gtk')
#webbrowser.open(magnet_link)
os.system('transmission-gtk ' + magnet_link)
As you can see I've tried 3 different options to add these torrents but none work.. I've also added XDG_RUNTIME_DIR="/run/user/1000" in the crontab file. The log in /var/mail is running the script but it shows: (transmission-gtk:14091): Gtk-WARNING **: cannot open display:. I've also run the command xhost + as said in http://www.thegeekstuff.com/2010/06/xhost-cannot-open-display/ but still the gtk-warning comes up. Anyone have any ideas? What I want eventually is that I run this script on a pi so if anyone has any alternatives, I'm all ears.. Thanks.

It's because you are trying to use GUI app where console one would be appropriate.
See man transmission-remote for details:
DESCRIPTION
transmission-remote is a remote control utility for transmission(1) and transmission-daemon(1).

Related

wine, console program, gtk error messages

From the linux console I run a windows console tool using:
wine console_tool.exe ....
The console tool does not involve any windows. It's output is just textual.
Some output is added repeatedly after a given delay time.
However, besides the output of the console_tool.exe I get repeatedly the following error message also interleaved with the other output:
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
I already tried to export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 but then the only change is that the error message changes:
ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
I also attempted to apt install the :i386 version of the libgtk3-nocsd.so.0 but it doesn't seem to exists.
I don't know why a console application may trigger a gtk error message. This is beyond my knowledge.
My preferred goal would be to tell wine that the .exe does not use windows and it does not need to not use gtk for windows emulation at all. However, as this may not be possible, my second preferred goal would be to solve the gtk issue.
Can you help me achieve at least one of those goals?
I do not know what the error messages mean. However, the wineconsole command runs console executable using wine. Example:
wineconsole console_tool.exe

Running into issues with Ubuntu geth >> Error: account unlock with HTTP access is forbidden

I am using Ubuntu 18.04-3 and when executing the command >
personal.unlockAccount(web3.eth.accounts[0],null)
I am getting the following error,
enter image description here
I tried some of the suggestions here (enter link description here)
and the suggestions (here) for the internal/ethapi/api.go
I included in the file
--allow-insecure-unlock (//I have add as in the suggestions but does not indicate where and how to place it//)
Appreciate your time in advance
You have places --allow-insecure-unlock at the wrong place. It should be when starting geth instant.
Example:
$ geth {--rpc etc your other flags} --allow-insecure-unlock

Systrace - error truncating /sys/kernel/debug/tracing/set_ftrace_filter: No such device (19) unable to start

I am currently working on a project which aims to find out what the system is doing behind a series of user interaction on the android UI. For example, if user click send button in Facebook Messenger, the measured response time for such action is 1.2 seconds. My goal is to figure out what the 1.2 seconds consist of. My friend suggested that I should take a look into 'Systrace'.
However, when I tried systrace on my HTC one M8, I have encountered some problems:
First, error opening /sys/kernel/debug/tracing/options/overwrite - no such file or directory. I solved this problem by building up the support of the kernel following http://opensourceforu.com/2010/11/kernel-tracing-with-ftrace-part-1/ and mount -t debugfs none /sys/kernel/debug. Then I could find the tracing directory. Besides, I set ro.debuggable=1 in file default.prop within Ramdisk and burn the boot.img into my phone.
Now I encounter another problem: when I run - python systrace.py --time=10 -o mynewtrace.html sched gfx view wm, the following error(19) pop up: error truncating /sys/kernel/debug/tracing/set_ftrace_filter: No such device (19). I don't know if the way my building up kernel support for systrace is incorrect or anything is missing.
Could anyone helps me out with this problem, please?
I think I have worked out the solution. My environment is Ubuntu 16.04 + HTC one M8. I will write the steps as followed:
open terminal and enter: $adb shell
(1) $su (2) $mount -t debugfs none /sys/kernel/debug. Now you should be able to see many directories under /sys/kernel/debug/. (You may cd into /sys/kernel/debug to confirm this)
New a new terminal and enter: dd if=/dev/block/platform/msm_sdcc.1/by-name/boot of=/sdcard/boot.img to generate the boot.img kernel image from your device.
Use AndroidImageKitchen to unpack the boot.img and find the default.prop within Ramdisk folder. Then change ro.debuggable=0 to ro.debuggable=1. Repack the boot.img and flash boot it to your device.
Once the device boot, under terminal, enter: adb root and message like: restarting adbd as root may pop up. Disconnect the USB and connect again.
cd to the systrace folder, e.g. ~/androidSDK/platform-tools/systrace and use:
python systrace.py --time=10 -o mynewtrace.html sched gfx view wm
Now you may able to generate your own systrace files.

Configuring Nexus 3 (3.0m7) to run as a Linux Service

Can anyone help me translate the instructions for setting this up as a Linux Service (at http://books.sonatype.com/nexus-book/3.0/reference/install.html#service-linux) into English?
After following them as best I could, I get the following when starting the service:
su: user / does not exist
Here are the parts of the instructions which were unclear:
In the bin/nexus script remove the line below.
INSTALL4J_JAVA_PREFIX="su - $run_as_user -c"
The line in the file is actually
INSTALL4J_JAVA_PREFIX=""
but ok, I can remove that. However, the next instruction is:
Replace the entire link with this line:
exec su - $run_as_user "$prg_dir/$progname" $#
What is meant by "the entire link"? The thing I removed above? That was the first line in the file - therefore the three variables above have not yet been set.... and is probably the reason the script currently fails.
I'll get the book fixed, it shouldn't have this in it anymore.
Download the 3.0 release, this was just a bug in 3.0m7, and it has been fixed. You don't need to make these changes.
https://support.sonatype.com/hc/en-us/articles/217965118
The only things you need to do is edit $NEXUS_HOME/bin/nexus.rc, uncomment the run_as_user line, and set the value for it appropriately. Then just symlink $NEXUS_HOME/bin/nexus to /etc/init.d/nexus, and after that run chkconfig or update-rc.d depending on your Linux version.

twisted web server not ruuning a .rpy file

i am a toddler on Twisted .I am trying to run a Twisted web server using the command
twistd web --resource-script=~/Desktop/step/ecdemo.rpy
assume that my file(ecdemo.rpy) is located on desktop in step folder
the traceback when i visit the page(127.0.0.1:8080/ecdemo.rpy) shows
<type 'exceptions.IOError'>: [Errno 2] No such file or directory: '~/Desktop/step/ecdemo.rpy
however if i run the same file with command
python ecdemo.rpy it runs smoothly.
The program simply renders a get request from an http page
I know it is something basic that i do not know but if you could help me get started i would come up with better problems...
thanks for help.
Your shell didn't expand ~ into your home directory. Try this instead:
twistd web --resource-script ~/Desktop/step/ecdemo.rpy
Notice I removed the = between the option name and its value. This will probably let your shell turn ~ into /home/whoever.

Resources