Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Debian Startup Script

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
AndyWh
Posts: 2
Joined: 2010-04-01 09:23

Debian Startup Script

#1 Post by AndyWh »

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

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

#2 Post by mzilikazi »

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

barriehie

Re: Debian Startup Script

#3 Post by barriehie »

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

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

#4 Post by mzilikazi »

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
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

Re: Debian Startup Script

#5 Post by bugsbunny »

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.

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

Re: Debian Startup Script

#6 Post by AndyWh »

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

User avatar
mzilikazi
Forum Account
Forum Account
Posts: 3282
Joined: 2004-09-16 02:14
Location: Colorado Springs, CO

Re: Debian Startup Script

#7 Post by mzilikazi »

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
bugsbunny
Posts: 5354
Joined: 2008-07-06 17:04
Been thanked: 1 time

Re: Debian Startup Script

#8 Post by bugsbunny »

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).

Post Reply