LINUX.ORG.RU
ФорумAdmin

Запуск python приложения в runit

 ,


0

1

Есть python приложение:

/usr/bin/python /usr/mongo-connector/mongo_connector/connector.py -m 10.10.10.18:27017 -t http://10.10.10.50:8080/solr-4.10.3/insights -n sphere_development.insights -g insights -d /usr/mongo-connector/mongo_connector/doc_managers/solr_doc_manager.py -o /usr/mongo-connector/oplogstatus_insights.txt -v --auto-commit-interval=0
Запускаю эту команду в шеле, все работает. Добавляю в runit фаил run с содержимым
#!/bin/sh
exec 2>&1
exec /usr/bin/python /usr/mongo-connector/mongo_connector/connector.py -m 10.10.10.18:27017 -t http://10.10.10.50:8080/solr-4.10.3/insights -n sphere_development.insights -g insights -d /usr/mongo-connector/mongo_connector/doc_managers/solr_doc_manager.py -o /usr/mongo-connector/oplogstatus_insights.txt -v --auto-commit-interval=0

Сделал симлинк из /etc/sv/mc_insights в /etc/service/mc_insights

Пробую запустить:

root@lochalhost:/etc/sv/mc_insights# sv start mc_insights
ok: run: mc_insights: (pid 3294) 1s
root@lochalhost:/etc/sv/mc_insights# sv status mc_insights
run: mc_insights: (pid 3590) 1s; down: log: 1s, normally up, want up

Вроде как стартует, но сразу падает. В папке /etc/sv/mc_insights/log создал фаил run

#!/bin/sh
LOG_FOLDER=/var/log/mc_insights
mkdir -p $LOG_FOLDER
exec svlogd -tt $LOG_FOLDER
но логи не появляются.

Пробовал в supervisor запустить, тоже не стартует. Выдает

mc_insights: ERROR (abnormal termination)
В логах supervisor
supervisor exit status 127; not expected

Если кто знает, подскажите в чем может быть ошибка.

Ответ на: комментарий от zolden

Если я правильно понял, то как-то так:

root@lochalhost:~# strace -f sv start mc_insights
execve("/usr/bin/sv", ["sv", "start", "mc_insights"], [/* 31 vars */]) = 0
arch_prctl(ARCH_SET_FS, 0x7fff07690860) = 0
gettimeofday({1421740652, 980014}, NULL) = 0
open(".", O_RDONLY|O_NONBLOCK)          = 3
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nr9:J\234\0\0\0\0\0d\0\0", 20) = 20
close(4)                                = 0
open("supervise/control", O_WRONLY|O_NONBLOCK) = 4
write(4, "u", 1)                        = 1
close(4)                                = 0
fchdir(3)                               = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nr9:J\234\0\0\0\0\0d\0\0", 20) = 20
close(4)                                = 0
fchdir(3)                               = 0
nanosleep({0, 420000000}, 0x7fff07690810) = 0
gettimeofday({1421740653, 401744}, NULL) = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nr9:J\234\0\0\0\0\0d\0\0", 20) = 20
close(4)                                = 0
fchdir(3)                               = 0
nanosleep({0, 420000000}, 0x7fff07690810) = 0
gettimeofday({1421740653, 823176}, NULL) = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nr9:J\234\0\0\0\0\0d\0\0", 20) = 20
close(4)                                = 0
fchdir(3)                               = 0
nanosleep({0, 420000000}, 0x7fff07690810) = 0
gettimeofday({1421740654, 244624}, NULL) = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nw9\357\372T\0\0\0\0\0u\0\0", 20) = 20
close(4)                                = 0
fchdir(3)                               = 0
nanosleep({0, 420000000}, 0x7fff07690810) = 0
gettimeofday({1421740654, 665972}, NULL) = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nw9\357\372T\0\0\0\0\0u\0\0", 20) = 20
close(4)                                = 0
fchdir(3)                               = 0
nanosleep({0, 420000000}, 0x7fff07690810) = 0
gettimeofday({1421740655, 87025}, NULL) = 0
chdir("/etc/service/")                  = 0
chdir("mc_insights")                    = 0
open("supervise/ok", O_WRONLY|O_NONBLOCK) = 4
close(4)                                = 0
open("supervise/status", O_RDONLY|O_NONBLOCK) = 4
read(4, "@\0\0\0T\276\nx:4\240\214\263 \0\0\0u\0\1", 20) = 20
close(4)                                = 0
stat("check", 0x7fff07690770)           = -1 ENOENT (No such file or directory)
stat("down", 0x7fff07690760)            = -1 ENOENT (No such file or directory)
write(1, "ok: run: mc_insights: (pid 8371)"..., 36ok: run: mc_insights: (pid 8371) 1s
) = 36
fchdir(3)                               = 0
_exit(0)                                = ?
+++ exited with 0 +++

Но вроде нечего криминального нет.

alivecor
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.