how to restart samba service after boot

Asked by luuminh

I want to know the way to run my program after I log in after 2 or 5 minutes.help me, please

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu samba Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:
Revision history for this message
Greg Beam (ki7mt) said :
#1

What program are you trying to run? Is it a script based (command line) program or does the application have a GUI associated with it?

Additionally, is it something you need to run every time you log in or just something you want use like a tool, utility, game or something?

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#2

use the at the command with the now + parameter

http://www.softpanorama.org/Utilities/at.shtml

echo "eject" | at now +2 min
echo "eject" | at now +5 min

Put the command into a script recall the script at session login menu→System→preferences→Startup applications

Hope this helps

Revision history for this message
luuminh (taolao-q) said :
#3

I want to run /etc/init.d/samba restart after log in 2 or 5 minutes

Revision history for this message
Greg Beam (ki7mt) said :
#4

If you have samba installed with it's defaults, then it should be running at boot time as a service unless you've updated rc.d

As luuminh said, you can add an entry to System >> Preferences >> Startup Applications and have it call a start script.

You could create a script that executes post log-in (say something triggered from your /bash_profile), but as this is a system level app, your going to need to provide the sudo password. The Bash command SLEEP can be added to the script to provide the delay time your looking for.

Easiest way really, but prone to forgetting, is to just open a terminal and:

sudo /etc/init.d/smbd start

Or, have the script run at boot (which is the normal mode of execution ) and control access through Samba permissions if your worried about access.
.

Revision history for this message
luuminh (taolao-q) said :
#5

my problem is my pc1 has 3 printers and they was shared on LAN, but when I boot
the pc, all PC on LAN can't see any printer on pc1, I must be run sudo
/etc/init.d/smbd restart and then all pc on LAN can see 3 printers, can you
guide me detail for the script ?

________________________________
Từ: KE1HA <email address hidden>
Đến: <email address hidden>
Gửi ngày: 16:16:22, Thứ Ba, 3 tháng 8 2010
Chủ đề: Re: [Question #119782]: run program

Your question #119782 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/119782

    Status: Open => Answered

KE1HA proposed the following answer:
If you have samba installed with it's defaults, then it should be
running at boot time as a service unless you've updated rc.d

As luuminh said, you can add an entry to System >> Preferences >>
Startup Applications and have it call a start script.

You could create a script that executes post log-in (say something
triggered from your /bash_profile), but as this is a system level app,
your going to need to provide the sudo password. The Bash command SLEEP
can be added to the script to provide the delay time your looking for.

Easiest way really, but prone to forgetting, is to just open a terminal
and:

sudo /etc/init.d/smbd start

Or, have the script run at boot (which is the normal mode of execution ) and
control access through Samba permissions if your worried about access.
.

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/ubuntu/+question/119782/+confirm?answer_id=3

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/ubuntu/+question/119782

You received this question notification because you are a direct
subscriber of the question.

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#6

Please try to put the restart of smbd command into... /etc/rc.local file to see if i works

from terminal type

gksudo gedit /etc/rc.local

add this row before the exit 0 row

/etc/init.d/smbd restart

save and exit and reboot

Revision history for this message
luuminh (taolao-q) said :
#7

follow your way, it's done, I even don't want log in, I just turn on pc, and I can see any printer from the other pc on LAN, thank's a lot.

Revision history for this message
Ananth s p (ananthp3) said :
#8

Thank you marcobra ,, you saved my time ..