Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6211505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:20:56+00:00 2026-05-24T06:20:56+00:00

This question is related to my previous one: Running erlang shell as a daemon/service

  • 0

This question is related to my previous one: Running erlang shell as a daemon/service

I have a script that looks like this:

#!/bin/bash
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions


export HEART_COMMAND="/etc/init.d/script restart"

start() {


        erl  -heart -pa DIR -sname NAME -setcookie COOKIE -env port 21 -s M -s M2 --
        ### Create the lock file ###
        touch /var/lock/lock
}

stop() {

        erl -noshell -sname temp_control -setcookie COOKIE -eval "rpc:call(NAME@ubuntu, init, stop, [])" -s init stop
        ### Now, delete the lock file ###
        rm -f /var/lock/lock
}


### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
       # start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit 0

I don’t know how to simulate a crash so I just tried ctrl+c and aborted the shell, the output looks like this:

root@ubuntu:/etc/init.d# ./script start
heart_beat_kill_pid = 17512
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
(NAME@ubuntu)1> Starting M2
Listening on port 21

(NAME@ubuntu)1>
(NAME@ubuntu)1>
(NAME@ubuntu)1>
(NAME@ubuntu)1>
(NAME@ubuntu)1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
a
heart: Fri Jul 29 09:25:10 2011: Erlang has closed.
root@ubuntu:/etc/init.d# heart_beat_kill_pid = 17557
heart: Fri Jul 29 09:25:13 2011: Erlang has closed.
/etc/init.d/NAME: line 20: 17557 Killed                  erl  -heart -pa DIR -sname NAME -setcookie COOKIE -env port 21 -s M -s M2 --
heart: Fri Jul 29 09:25:13 2011: Executed "/etc/init.d/script restart". Terminating.
heart_beat_kill_pid = 17602
heart: Fri Jul 29 09:25:15 2011: Erlang has closed.
/etc/init.d/NAME: line 20: 17602 Killed                  erl  -heart -pa DIR -sname NAME -setcookie COOKIE -env port 21 -s M -s M2 --
heart: Fri Jul 29 09:25:15 2011: Executed "/etc/init.d/script restart". Terminating.
heart: Fri Jul 29 09:25:17 2011: Executed "/etc/init.d/script restart". Terminating.

root@ubuntu:/etc/init.d#

This goes on for ever if I don’t comment the line of code in the script that starts it. It’s like an endless loop of terminating erlang shells… or something.

If I try for example “export HEART_COMMAND=”/bin/echo hello” it says “write error: broken pipe”.

Why doesn’t it work? How do I simulate a crash properly to check if the heart command work?

Thankful for any advice you might have.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:20:57+00:00Added an answer on May 24, 2026 at 6:20 am

    Answering the question you didn’t ask
    (but mentioned a couple of times that you don’t know how to do)

    To simulate a crash so kill -SEGV <PID>

    Example:

    $ sleep 30 &
    [1] 13274
    
    
    $ kill -SEGV 13274
    [1]+  Segmentation fault      sleep 30
    

    Also, So while I don’t know erlang, I presume that it spawns multiple threads and one thread can monitor another by sending heartbeat messages. If the other thread does not respond, it is assumed to be hung and restarted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is related to my previous question , but a different one. I have
Ok guys, this question is related to my previous one. If I have set
This question is related with one of my earlier questions.. Previous Post In there
This is a CSS related question, I got one good answer from my previous
This question is related to a previous question of mine That's my current code
This question is related to my previous question . The storyline: I have an
This question is related to this previous one on how to replace accented strings
This is semi-related to my previous question . As that previous question states, I
This is related to my previous question , but it seems I have another
This is closely related to a previous question i asked. I have a many-to-many

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.