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 7743197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:28:13+00:00 2026-06-01T09:28:13+00:00

We are running an erlang program (ejabberd). Sometimes, we need to do health checks

  • 0

We are running an erlang program (ejabberd). Sometimes, we need to do health checks by connecting an erl shell to this running erlang program.

I am trying to script all this, and rather than typing erl -sname r -remsh .... and then, my command in the erlang shell, I’m looking for way to directly execute that command from my bash shell and get the output. Is this possible?

After Odobenus’s answer, I wrote this little script:

#!/usr/bin/env escript
%%! -sname r -setcookie `cat ~ejabberd/.erlang.cookie`

main([]) -> 
    Res = rpc:call(ejabberd@xmpp,mnesia,info,[]),
    io:format("~p~n",[Res]).

The problem is that I get a “Node Down” Error, even though these are the exact same params I use to connect with erl: erl -sname r -remsh ejabberd@xmpp -setcookie `cat ~ejabberd/.erlang.cookie`

  • 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-06-01T09:28:15+00:00Added an answer on June 1, 2026 at 9:28 am

    you can write escript for that purpose http://www.erlang.org/doc/man/escript.html

    kind of (for example tst.erl)

    #!/usr/bin/env escript
    %%! -sname r 
    
    main([Cookie]) -> 
        erlang:set_cookie(node(),list_to_atom(Cookie)),
        Res = rpc:call(name@somenode,somemodule,somefunction,[]),
        io:format("~p~n",[Res]).
    

    and call it from bash script

    ./tst.erl `cat verythatfile`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to my previous one: Running erlang shell as a daemon/service
I have a running erlang application, launched with this command line erl -boot start_sasl
I have been trying to learn Erlang and have been running into some problems
I'm trying to create an ejabberd module which uses mongodb-erlang as the driver. I'm
I'm trying to write a basic Erlang program that reads in a file in
I am trying to communicate an Erlang program with a simple Qt window app
I am trying to cross-compile Erlang and running into a weird bug. The commands
Running the static analyzer on this piece of code: - (id) readForeignPref { CFPropertyListRef
Long story short I am trying to replicate the Sleeping barber problem in Erlang.
I was reading the erlang documentation about file io and saw this: On operating

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.