Debian Startup Script

New to Debian (Or Linux in general)? Ask your questions here!

Debian Startup Script

Postby AndyWh » 2010-04-01 09:35

Hi all,

I'm a Windows admin (yeah, I know!) with a large Citrix user base. Up until recently we've used WinCE thin client devices, but I've just made the decision to move to Debian based HP ThinOS devices. One great feature of these is the ability to run scripts at startup by dropping them into an FTP folder for all the clients to read - the only problem being that I haven't a clue where to start with a Debian script.

What I'd like to do initially is to write the client's system specs (e.g. memory, processor, etc) and/or config (IP address, Citrix connections, etc) to a text file on a Windows fileserver. I already do this with Windows clients, so would like to keep it running. Currently, the text file is saved to a UNC path and uses the device's name, e.g. HP1234.txt

Would anybody be able to give me some pointers on how I start this off? Once I know how to build a basic script and write the file to a UNC path, I'm sure Google can help provide the rest.

Cheers

Andy
AndyWh
 
Posts: 2
Joined: 2010-04-01 09:23

Re: Debian Startup Script

Postby mzilikazi » 2010-04-01 14:07

What sort of a script? A shell script?

Code: Select all
#!/bin/bash
#Comment here
do something here

Then make it executable.
Code: Select all
chmod +x name_of_script.sh


Example:

Code: Select all
#!/bin/bash
echo "Yee Haw." #this is a comment
#this is also a comment
echo "files in this directory:"
ls -al

Make it executable and run it
Code: Select all
chmod +x file_list.sh
./file_list.sh


Plenty of documentation on BASH scripting:
http://tldp.org/LDP/abs/html/

I know nothing of Citrix and last I heard UNC was a school in North Carolina. :)
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

Postby barriehie » 2010-04-02 00:08

Are these scripts run once and then exit or are they daemons?
barriehie
 

Re: Debian Startup Script

Postby mzilikazi » 2010-04-02 00:32

barriehie wrote:Are these scripts run once and then exit or are they daemons?

Definitely not a daemon. Just a disposable script. If a daemon-like functionality is what you want consider cron or my preference anacron (man anacron) that can run anything at a specified interval. anacron/cron can call your script. Of course you can also call the script on boot or login.
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

Postby bugsbunny » 2010-04-03 04:03

You may also find this script useful inxi - Project Hosting on Google Code

UNC paths depends on where you want to store the files. Normally to set up shares in Linux that are accessible from Windows you need to install and configure Samba. To access Windows shares from Debian (or any Linux system) install smbfs and see the man pages for mount.cifs. You may also find smbclient useful.
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Re: Debian Startup Script

Postby AndyWh » 2010-04-06 08:29

Hi guys

They are just to execute on startup. To my knowledge, the OS executes all script files that are located within a specific folder on the FTP site during boot.

I've had a quick nose at the links you've sent through, which I think will be all I need to get started, although setting up samba may be a no go unless the device already supports it. Using bash, how would I go about starting or checking if the smbfs service is running? Is there a command I can use to list files within a remote directory on a Windows file share?

Thanks very much everyone !

Cheers

Andy
AndyWh
 
Posts: 2
Joined: 2010-04-01 09:23

Re: Debian Startup Script

Postby mzilikazi » 2010-04-06 15:03

AndyWh wrote: Using bash, how would I go about starting or checking if the smbfs service is running?


Code: Select all
ps aux|grep mbd


Is there a command I can use to list files within a remote directory on a Windows file share?


Code: Select all
ls /path/to/share


This is assuming you have the share mounted of course. Check out the man page for ls

Code: Select all
man ls
ls - list directory contents
Debian Sid Laptops:
AMD Athlon(tm) 64 X2 Dual-Core Processor TK-55 / 1.5G
Intel(R) Pentium(R) Dual CPU T2390 @ 1.86GHz / 3G
User avatar
mzilikazi
Forum Ninja
 
Posts: 3321
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

Postby bugsbunny » 2010-04-06 15:36

Code: Select all
ps aux|grep mbd


Uh - smbfs is not a "service", and doesn't "run". It does provide mount.cifs (located in /sbin). You should have smbfs installed if you want to mount Windows shares from within Debian (you don't need fullblown samba for that).
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable