Debian and Ubuntu have a more graceful way of doing these things. Google
chkconfig I think.
On Apr 9, 2014 9:24 PM, "Michael Havens" <
bmike1@gmail.com> wrote:
> think I found a way.
> :
> https://langit.wordpress.com/2014/02/01/simple-way-to-execute-a-command-on-startup-in-ubuntu/
>
> (Please tell me if I found the correct means of doing this.)
>
>
> I would like to share with you a simple way to execute commands on startup
> in Ubuntu. This tip is very useful for example I have an issue on the
> Netatalk service that do not run properly so every time I have to run the
> command to restart the service after I login to Ubuntu.
>
> All commands that you need to be executed must be stored in etc/rc.local
> setting. Open terminal then execute this command:
>
>
>
> sudo nano /etc/rc.local
>
> Add the following command to restart Netatalk service, right before "exit
> 0":
>
>
>
> sudo /etc/init.d/ssh start
> exit 0
>
> That's it! It's so simple. I have solved the Netatalk service problem for
> now. So I have more time to take a look what is the problem with the
> Netatalk service.
>
> and then:
>
> sudo chmod +x /etc/rc.local
>
> after I'm done?
>
> As I was verifying commands for this email this happened:
>
> bmike1@PresarioLapTop1:~$ sudo /etc/init.d/ssh
> /lib/init/upstart-job: 28: shift: can't shift that many
> bmike1@PresarioLapTop1:~$ /etc/init.d/ssh
> * Usage: /etc/init.d/ssh
> {start|stop|reload|force-reload|restart|try-restart|status}
>
> is the first 'error' because ssh is already started?
>
> :-)~MIKE~(-:
>
>
> On Wed, Apr 9, 2014 at 8:57 PM, Michael Havens <bmike1@gmail.com> wrote:
>
>> well, there is the skeleton file which I'm sure you use but I'm not
>> sure.....
>>
>> cat /etc/init.d/skeleton
>> #! /bin/sh
>> ### BEGIN INIT INFO
>> # Provides: skeleton
>> # Required-Start: $remote_fs $syslog
>> # Required-Stop: $remote_fs $syslog
>> # Default-Start: 2 3 4 5
>> # Default-Stop: 0 1 6
>> # Short-Description: Example initscript
>> # Description: This file should be used to construct scripts to be
>> # placed in /etc/init.d.
>> ### END INIT INFO
>>
>> # Author: Foo Bar <foobar@baz.org>
>> #
>> # Please remove the "Author" lines above and replace them
>> # with your own name if you copy and modify this script.
>>
>> # Do NOT "set -e"
>>
>> # PATH should only include /usr/* if it runs after the mountnfs.sh script
>> PATH=/sbin:/usr/sbin:/bin:/usr/bin
>> DESC="Description of the service"
>> NAME=daemonexecutablename
>> DAEMON=/usr/sbin/$NAME
>> DAEMON_ARGS="--options args"
>> PIDFILE=/var/run/$NAME.pid
>> SCRIPTNAME=/etc/init.d/$NAME
>>
>> # Exit if the package is not installed
>> [ -x "$DAEMON" ] || exit 0
>>
>> # Read configuration variable file if it is present
>> [ -r /etc/default/$NAME ] && . /etc/default/$NAME
>>
>> # Load the VERBOSE setting and other rcS variables
>> . /lib/init/vars.sh
>>
>> # Define LSB log_* functions.
>> # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
>> # and status_of_proc is working.
>> . /lib/lsb/init-functions
>>
>> #
>> # Function that starts the daemon/service
>> #
>> do_start()
>> {
>> # Return
>> # 0 if daemon has been started
>> # 1 if daemon was already running
>> # 2 if daemon could not be started
>> start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
>> --test > /dev/null \
>> || return 1
>> start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
>> $DAEMON_ARGS \
>> || return 2
>> # Add code here, if necessary, that waits for the process to be ready
>> # to handle requests from services started subsequently which depend
>> # on this one. As a last resort, sleep for some time.
>> }
>>
>> #
>> # Function that stops the daemon/service
>> #
>> do_stop()
>> {
>> # Return
>> # 0 if daemon has been stopped
>> # 1 if daemon was already stopped
>> # 2 if daemon could not be stopped
>> # other if a failure occurred
>> start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile
>> $PIDFILE --name $NAME
>> RETVAL="$?"
>> [ "$RETVAL" = 2 ] && return 2
>> # Wait for children to finish too if this is a daemon that forks
>> # and if the daemon is only ever run from this initscript.
>> # If the above conditions are not satisfied then add some other code
>> # that waits for the process to drop all resources that could be
>> # needed by services started subsequently. A last resort is to
>> # sleep for some time.
>> start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec
>> $DAEMON
>> [ "$?" = 2 ] && return 2
>> # Many daemons don't delete their pidfiles when they exit.
>> rm -f $PIDFILE
>> return "$RETVAL"
>> }
>>
>> #
>> # Function that sends a SIGHUP to the daemon/service
>> #
>> do_reload() {
>> #
>> # If the daemon can reload its configuration without
>> # restarting (for example, when it is sent a SIGHUP),
>> # then implement that here.
>> #
>> start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name
>> $NAME
>> return 0
>> }
>>
>> case "$1" in
>> start)
>> [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
>> do_start
>> case "$?" in
>> 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
>> 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
>> esac
>> ;;
>> stop)
>> [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
>> do_stop
>> case "$?" in
>> 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
>> 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
>> esac
>> ;;
>> status)
>> status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
>> ;;
>> #reload|force-reload)
>> #
>> # If do_reload() is not implemented then leave this commented out
>> # and leave 'force-reload' as an alias for 'restart'.
>> #
>> #log_daemon_msg "Reloading $DESC" "$NAME"
>> #do_reload
>> #log_end_msg $?
>> #;;
>> restart|force-reload)
>> #
>> # If the "reload" option is implemented then remove the
>> # 'force-reload' alias
>> #
>> log_daemon_msg "Restarting $DESC" "$NAME"
>> do_stop
>> case "$?" in
>> 0|1)
>> do_start
>> case "$?" in
>> 0) log_end_msg 0 ;;
>> 1) log_end_msg 1 ;; # Old process is still running
>> *) log_end_msg 1 ;; # Failed to start
>> esac
>> ;;
>> *)
>> # Failed to stop
>> log_end_msg 1
>> ;;
>> esac
>> ;;
>> *)
>> #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
>> echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
>> exit 3
>> ;;
>> esac
>>
>> :
>> bmike1@PresarioLapTop1:~$
>>
>>
>> :-)~MIKE~(-:
>>
>>
>> On Wed, Apr 9, 2014 at 8:51 PM, Michael Havens <bmike1@gmail.com> wrote:
>>
>>> hey.... I figured out the command to issue:
>>>
>>> /etc/init.d/ssh start
>>>
>>> but am unsure of where to put it to always activate it.
>>>
>>> :-)~MIKE~(-:
>>>
>>>
>>> On Wed, Apr 9, 2014 at 8:42 PM, Michael Havens <bmike1@gmail.com> wrote:
>>>
>>>> so, like, I ran 'apt-get install ssh' and apt-get told me it was also
>>>> going to install:
>>>>
>>>> ncurses-term openssh-client openssh-server ssh-import-id
>>>>
>>>> so there is what I was looking for! openssh-server. Anyways, what file
>>>> do I need to put in /etc/ssh.d so it will always restart upon a reboot?
>>>>
>>>> :-)~MIKE~(-:
>>>>
>>>>
>>>> On Wed, Apr 9, 2014 at 8:31 PM, Michael Havens <bmike1@gmail.com>wrote:
>>>>
>>>>> so what directory runs scripts automatically? is it /etc/ssh.d ? I
>>>>> just put a text file with the desired script in there or is there something
>>>>> else I have to do?
>>>>>
>>>>> :-)~MIKE~(-:
>>>>>
>>>>>
>>>>> On Wed, Apr 9, 2014 at 3:09 PM, Michael Havens <bmike1@gmail.com>wrote:
>>>>>
>>>>>> did it!
>>>>>> apt-get install ssh
>>>>>> did it
>>>>>>
>>>>>> :-)~MIKE~(-:
>>>>>>
>>>>>>
>>>>>> On Wed, Apr 9, 2014 at 2:17 PM, Stephen Partington <
>>>>>> cryptworks@gmail.com> wrote:
>>>>>>
>>>>>>> should be "/etc/init.d/sshd start" or something similar and then
>>>>>>> depending on dist you simply ad that start script to the system startup
>>>>>>> chkconfig or something similar. you can also list what is in your init.d
>>>>>>> and see what is there.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Apr 9, 2014 at 1:57 PM, Michael Havens <bmike1@gmail.com>wrote:
>>>>>>>
>>>>>>>> how do you turn openssl on? just installing it didn't do it. what
>>>>>>>> happened to openssl-server?
>>>>>>>>
>>>>>>>> :-)~MIKE~(-:
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Apr 9, 2014 at 1:51 PM, Michael Havens <bmike1@gmail.com>wrote:
>>>>>>>>
>>>>>>>>> You know.... I seem to remember being able to pull files to the
>>>>>>>>> host in another incarnation of the VM. Doesn't that mean sshd isn't
>>>>>>>>> installed? So the easy fix is apt-get install sshd..... right?
>>>>>>>>>
>>>>>>>>> ohhh I remember now! I had to install ssh-server....
>>>>>>>>> thank you Stephen... openssl . I thought it was openssl-server I
>>>>>>>>> hap to install but it nolonger is in the repositories.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> :-)~MIKE~(-:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Apr 9, 2014 at 1:33 PM, Michael Havens <bmike1@gmail.com>wrote:
>>>>>>>>>
>>>>>>>>>> I attempted to transfer a file from a virtual machine to the host
>>>>>>>>>> with less than stellar results:
>>>>>>>>>>
>>>>>>>>>> root@LFS:/# scp mnt/lfs/sources/binutils-2.24/binutils2.24.run
>>>>>>>>>> bmike1@192.168.0.4:/home/bmike1/Documents
>>>>>>>>>> ssh: connect to host 192.168.0.4 port 22: Connection refused
>>>>>>>>>> lost connection
>>>>>>>>>> root@LFS:/#
>>>>>>>>>>
>>>>>>>>>> I remember this happened before in another situation and there is
>>>>>>>>>> a solution but can't remember that solution. Could someone help me?
>>>>>>>>>> :-)~MIKE~(-:
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------
>>>>>>>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>>>>>>>> To subscribe, unsubscribe, or to change your mail settings:
>>>>>>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> A mouse trap, placed on top of your alarm clock, will prevent you
>>>>>>> from rolling over and going back to sleep after you hit the snooze button.
>>>>>>>
>>>>>>> Stephen
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------
>>>>>>> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
>>>>>>> To subscribe, unsubscribe, or to change your mail settings:
>>>>>>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss