Lines Matching refs:sj

658 void sentinelReleaseScriptJob(sentinelScriptJob *sj) {  in sentinelReleaseScriptJob()  argument
661 while(sj->argv[j]) sdsfree(sj->argv[j++]); in sentinelReleaseScriptJob()
662 zfree(sj->argv); in sentinelReleaseScriptJob()
663 zfree(sj); in sentinelReleaseScriptJob()
671 sentinelScriptJob *sj; in sentinelScheduleScriptExecution() local
683 sj = zmalloc(sizeof(*sj)); in sentinelScheduleScriptExecution()
684 sj->flags = SENTINEL_SCRIPT_NONE; in sentinelScheduleScriptExecution()
685 sj->retry_num = 0; in sentinelScheduleScriptExecution()
686 sj->argv = zmalloc(sizeof(char*)*(argc+1)); in sentinelScheduleScriptExecution()
687 sj->start_time = 0; in sentinelScheduleScriptExecution()
688 sj->pid = 0; in sentinelScheduleScriptExecution()
689 memcpy(sj->argv,argv,sizeof(char*)*(argc+1)); in sentinelScheduleScriptExecution()
691 listAddNodeTail(sentinel.scripts_queue,sj); in sentinelScheduleScriptExecution()
700 sj = ln->value; in sentinelScheduleScriptExecution()
702 if (sj->flags & SENTINEL_SCRIPT_RUNNING) continue; in sentinelScheduleScriptExecution()
705 sentinelReleaseScriptJob(sj); in sentinelScheduleScriptExecution()
721 sentinelScriptJob *sj = ln->value; in sentinelGetScriptListNodeByPid() local
723 if ((sj->flags & SENTINEL_SCRIPT_RUNNING) && sj->pid == pid) in sentinelGetScriptListNodeByPid()
742 sentinelScriptJob *sj = ln->value; in sentinelRunPendingScripts() local
746 if (sj->flags & SENTINEL_SCRIPT_RUNNING) continue; in sentinelRunPendingScripts()
749 if (sj->start_time && sj->start_time > now) continue; in sentinelRunPendingScripts()
751 sj->flags |= SENTINEL_SCRIPT_RUNNING; in sentinelRunPendingScripts()
752 sj->start_time = mstime(); in sentinelRunPendingScripts()
753 sj->retry_num++; in sentinelRunPendingScripts()
761 "%s %d %d", sj->argv[0], 99, 0); in sentinelRunPendingScripts()
762 sj->flags &= ~SENTINEL_SCRIPT_RUNNING; in sentinelRunPendingScripts()
763 sj->pid = 0; in sentinelRunPendingScripts()
766 execve(sj->argv[0],sj->argv,environ); in sentinelRunPendingScripts()
771 sj->pid = pid; in sentinelRunPendingScripts()
803 sentinelScriptJob *sj; in sentinelCollectTerminatedScripts() local
814 sj = ln->value; in sentinelCollectTerminatedScripts()
820 sj->retry_num != SENTINEL_SCRIPT_MAX_RETRY) in sentinelCollectTerminatedScripts()
822 sj->flags &= ~SENTINEL_SCRIPT_RUNNING; in sentinelCollectTerminatedScripts()
823 sj->pid = 0; in sentinelCollectTerminatedScripts()
824 sj->start_time = mstime() + in sentinelCollectTerminatedScripts()
825 sentinelScriptRetryDelay(sj->retry_num); in sentinelCollectTerminatedScripts()
831 "%s %d %d", sj->argv[0], bysignal, exitcode); in sentinelCollectTerminatedScripts()
834 sentinelReleaseScriptJob(sj); in sentinelCollectTerminatedScripts()
849 sentinelScriptJob *sj = ln->value; in sentinelKillTimedoutScripts() local
851 if (sj->flags & SENTINEL_SCRIPT_RUNNING && in sentinelKillTimedoutScripts()
852 (now - sj->start_time) > SENTINEL_SCRIPT_MAX_RUNTIME) in sentinelKillTimedoutScripts()
855 sj->argv[0], (long)sj->pid); in sentinelKillTimedoutScripts()
856 kill(sj->pid,SIGKILL); in sentinelKillTimedoutScripts()
869 sentinelScriptJob *sj = ln->value; in sentinelPendingScriptsCommand() local
875 while (sj->argv[j]) j++; in sentinelPendingScriptsCommand()
878 while (sj->argv[j]) addReplyBulkCString(c,sj->argv[j++]); in sentinelPendingScriptsCommand()
882 (sj->flags & SENTINEL_SCRIPT_RUNNING) ? "running" : "scheduled"); in sentinelPendingScriptsCommand()
885 addReplyBulkLongLong(c,sj->pid); in sentinelPendingScriptsCommand()
887 if (sj->flags & SENTINEL_SCRIPT_RUNNING) { in sentinelPendingScriptsCommand()
889 addReplyBulkLongLong(c,mstime() - sj->start_time); in sentinelPendingScriptsCommand()
891 mstime_t delay = sj->start_time ? (sj->start_time-mstime()) : 0; in sentinelPendingScriptsCommand()
898 addReplyBulkLongLong(c,sj->retry_num); in sentinelPendingScriptsCommand()