Bruno Manzo
Bruno Manzo

Reputation: 374

Custom init.d script issue

I am trying to setup a new service with in init.d folder, but I am having a strange issue this time. I created a new service and just put a echo there:

echo "asdsad"

When I call it without parameters, looks perfect: brunomanzo@platform-hdfs-01:/etc$ sudo service hadoop-hdfs asdsad:

But when I call with a start/stop param, it prints nothing: brunomanzo@platform-hdfs-01:/etc$ sudo service hadoop-hdfs start

Upvotes: 0

Views: 201

Answers (1)

Elminson De Oleo Baez
Elminson De Oleo Baez

Reputation: 630

1) The file must be in /etc/init.d/

2) You are missing this

sudo chmod 755 /etc/init.d/hadoop-hdfs
sudo chown root:root /etc/init.d/hadoop-hdfs

My result after testing

root@server:/# echo "echo \"Test service\"">> /etc/init.d/hadoop-hdfs
root@server:/# chmod 755 /etc/init.d/hadoop-hdfs
root@server:/# chown root:root /etc/init.d/hadoop-hdfs
root@server:/# sudo service hadoop-hdfs
Test service
root@server:/# sudo service hadoop-hdfs start
Test services
root@server:/# service hadoop-hdfs start
Test services

Tested

1) with sudo
2) without sudo
3) with start
4) without start

Upvotes: 1

Related Questions