Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

SiriProxy as background service #137

Closed
dcinzona opened this issue Dec 4, 2011 · 21 comments
Closed

SiriProxy as background service #137

dcinzona opened this issue Dec 4, 2011 · 21 comments

Comments

@dcinzona
Copy link

dcinzona commented Dec 4, 2011

Hey,
I'm trying to get SiriProxy to run as a background service on my Synology DiskStation.
I was able to get it all set up so that I can run it manually from SSH. I also have the script working in the startup and Synology packages section... the problem is, I can see the process start and then stop after a second.
I can confirm that I am running it as root and the script itself works (when I run the launch script manually, it works fine).

I'm starting to wonder if it has to do with Ruby and logging to the console (since it runs in the background, there's no console to log to I would imagine)

Either way, this is REALLY freaking cool and I'm so close! I dont want to have to keep an SSH session open every time I want siriproxy running (which is: eternally).

In case you want to know, this is the script that currently (and successfully when run from SSH manually) starts SiriProxy:
Also, just of note - i set the sudo option to NOPASSWD specifically for the script so it will run without prompting for password

!/bin/sh

PKGNAME="siriproxy"
PKGPATH="/var/packages/"${PKGNAME}

SPBIN=${PKGNAME}

SPSTART=sudo /opt/bin/ruby /opt/bin/siriproxy server

case $1 in
start)
echo "Starting SiriProxy ..."
${SPSTART}
exit 0
;;
stop)
echo "Stopping SiriProxy ..."
killall ${SPBIN}
exit 0
;;
status)
ps | grep -v grep | grep /opt/bin/siriproxy > /dev/null
if [ $? -ne 0 ]; then
echo "Status: SiriProxy is not running"
exit 1
fi
echo "Status: SiriProxy is running"
exit 0
;;

esac

@dcinzona
Copy link
Author

dcinzona commented Dec 4, 2011

Or maybe there's a way to log the output to a file instead of console? Or just an error log?

@dcinzona
Copy link
Author

dcinzona commented Dec 6, 2011

getting places... I found out that running the script through the web interface produces this error:

command_line.rb:142:in expand_path': couldn't find HOME environment -- expanding~'

I could manually change it and have it point directly to /root/ but I dont want to do that. Any ideas?

@dcinzona
Copy link
Author

dcinzona commented Dec 6, 2011

Cool, got it to start running using the web interface by adding /opt/bin/sudo before the rest of the command

@dcinzona
Copy link
Author

dcinzona commented Dec 6, 2011

Just a note. finally got it working as a background service on my Synology.

AWESOME

@dcinzona dcinzona closed this as completed Dec 6, 2011
@evandcoleman
Copy link

How did you get it to work, when I run your script from Terminal, siriproxy just starts logging to the console like usual. When I make a cron job to run it, I get this error:

/root/siriproxy/bin/siriproxy:4:in `require': /root/siriproxy/bin/../lib/siriproxy/command_line.rb:74: syntax error, unexpected '>' (SyntaxError)
repl = -> prompt { print prompt; cora.process(gets.chomp!) }
^
from /root/siriproxy/bin/siriproxy:4
/etc/init.d/siriproxy: line 31: syntax error: unexpected end of file

@dcinzona
Copy link
Author

Hmm, I'm running it as root using sudo. Also I haven't updated since 0.3

On Dec 31, 2011, at 11:23, Evan Colemanreply@reply.github.com wrote:

How did you get it to work, when I run your script from Terminal, siriproxy just starts logging to the console like usual. When I make a cron job to run it, I get this error:

/root/siriproxy/bin/siriproxy:4:in `require': /root/siriproxy/bin/../lib/siriproxy/command_line.rb:74: syntax error, unexpected '>' (SyntaxError)
repl = -> prompt { print prompt; cora.process(gets.chomp!) }
^
from /root/siriproxy/bin/siriproxy:4
/etc/init.d/siriproxy: line 31: syntax error: unexpected end of file


Reply to this email directly or view it on GitHub:
#137 (comment)

@evandcoleman
Copy link

Yeah, that's probably it.

Anyone know how to do this with the latest version?

@earlcochran
Copy link

Anyone make any progress on this for current version?

@3x3cut0r
Copy link

3x3cut0r commented Feb 4, 2012

@dcinzona
could u write a little tutorial how u could run a siriproxy on a synology NAS?
i have one and im very interessted on a siriproxy on my DS-712+ too.
or could u contact me by email?

thx

@dcinzona
Copy link
Author

I just updated siriproxy and it no longer runs as a background service... need to look into it a bit more again.
It runs fine when I run it manually from ssh, but for some reason it doesn't start when I start it from the web interface.

@dcinzona
Copy link
Author

OK, I got it working again... I keep forgetting to > dev/null the new plugin gem spec files.
@3x3cut0r what problems are you having. A tutorial is kind of not really possible since I totally hacked it in over hours of troubleshooting.

@3x3cut0r
Copy link

actually my problem is to "rake install" ... the error msg: "You have to install development tools first." but i dont know how?!
but u say it ... hours of troubleshooting ... the same here -.-
i'm on the verge to give up :/

@dcinzona
Copy link
Author

Google development tools synology install.

On Feb 12, 2012, at 11:37, 3x3cut0rreply@reply.github.com wrote:

actually my problem is to "rake install" ... the error msg: "You have to install development tools first." but i dont know how?!
but u say it ... hours of troubleshooting ... the same here -.-
i'm on the verge to give up :/


Reply to this email directly or view it on GitHub:
#137 (comment)

@dcinzona
Copy link
Author

http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc

On Feb 12, 2012, at 11:37, 3x3cut0rreply@reply.github.com wrote:

actually my problem is to "rake install" ... the error msg: "You have to install development tools first." but i dont know how?!
but u say it ... hours of troubleshooting ... the same here -.-
i'm on the verge to give up :/


Reply to this email directly or view it on GitHub:
#137 (comment)

@3x3cut0r
Copy link

do u mean "ipkg install optware-devel"? ... this alone are not fixing my problem
then i have found this:
http://sourceforge.net/projects/dsgpl/files/DSM%203.1%20Tool%20Chains/Intel%20x86%20Linux%202.6.32/
an 214mb tool chain for synology DSM 3.1 ... not really, or?

@dcinzona
Copy link
Author

Yeah you need the tool chain

On Feb 13, 2012, at 5:02, 3x3cut0rreply@reply.github.com wrote:

do u mean "ipkg install optware-devel"? ... this alone are not fixing my problem
then i have found this:
http://sourceforge.net/projects/dsgpl/files/DSM%203.1%20Tool%20Chains/Intel%20x86%20Linux%202.6.32/
an 214mb tool chain for synology DSM 3.1 ... not really, or?


Reply to this email directly or view it on GitHub:
#137 (comment)

@3x3cut0r
Copy link

i fixed it now ...
i have to change
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
to
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"
and its working now

Set up RVM and Ruby 1.9.3 (1.-3.) is working without errors and
Set up SiriProxy is working until "siriproxy bundle":
ERROR: Gem bundler is not installed, run gem install bundler first.
"gem install bundler" is working fine but does not help ?!

u have a solution?

@3x3cut0r
Copy link

i have it!
first i had to link the siriproxy script, so i can run it from everywhere:
ln -s /usr/local/rvm/gems/ruby-1.9.3-p0@SiriProxy/gems/siriproxy-0.3.0/bin/siriproxy /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/

then i had to cp the bundle to the right bin folder:
cp /usr/local/rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.22/bin/bundle /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/
(fix the "Gem bundler is not installed"-Error)

then
cd /root/.siriproxy/
rvmsudo siriproxy bundle
rvmsudo siriproxy server (here, i had a problem with libcrypto.so.0.9.8 no such file or directory ... i solved it with:
cp /usr/lib/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.0.9.8 )

very nice ... now i have to build a running startupscript ... how is the status of yours dcinzona? is it working?
and i have to test it at home at my wlan.

@dcinzona
Copy link
Author

Yeah mine is working :)

On Feb 14, 2012, at 15:56, 3x3cut0rreply@reply.github.com wrote:

i have it!
first i had to link the siriproxy script, so i can run it from everywhere:
ln -s /usr/local/rvm/gems/ruby-1.9.3-p0@SiriProxy/gems/siriproxy-0.3.0/bin/siriproxy /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/

then i had to cp the bundle to the right bin folder:
cp /usr/local/rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.22/bin/bundle /usr/local/rvm/rubies/ruby-1.9.3-p0/bin/
(fix the "Gem bundler is not installed"-Error)

then
cd /root/.siriproxy/
rvmsudo siriproxy bundle
rvmsudo siriproxy server (here, i had a problem with libcrypto.so.0.9.8 no such file or directory ... i solved it with:
cp /usr/lib/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.0.9.8 )

very nice ... now i have to build a running startupscript ... how is the status of yours dcinzona? is it working?
and i have to test it at home at my wlan.


Reply to this email directly or view it on GitHub:
#137 (comment)

@3x3cut0r
Copy link

i dont think that your script is working for me.
first i could start ruby, siriproxy only with /bin/bash ... not /bin/sh
second: /opt/bin/siriproxy doesn't exist (see my last post, k i could link it again ...)
and last /var/packages/siriproxy is your siriproxy repository folder?

@dcinzona
Copy link
Author

I had to link siriproxy to opt bin.
Will check the location when I get home

On Feb 14, 2012, at 17:00, 3x3cut0rreply@reply.github.com wrote:

i dont think that your script is working for me.
first i could start ruby, siriproxy only with /bin/bash ... not /bin/sh
second: /opt/bin/siriproxy doesn't exist (see my last post, k i could link it again ...)
and last /var/packages/siriproxy is your siriproxy repository folder?


Reply to this email directly or view it on GitHub:
#137 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants