Programming :: How Can User Runs Bash Script At Boot Of PC?
Dec 28, 2008
I wanna that the pc starts (on/off), the pc arrives to gdm. It waits for an user to log.But but at the boot of this machine, I would like that an user has a script started in the processes (NO X cuz bash script).How can an user runs a script at boot of the PC ? (once only and no one loged)
I'm trying to do a shell script which are suppose to run a program as a specific user at system boot up. The problem is that I don't know for sure how to make the script add the users password to the prompt when it's necessary.
How would I make this script run this program as user extrema with the password "hidden" at boot-up? I know how to put the script in the rc.X directory and so on, its more the syntax of the code.
I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?
I need to switch from one user to another in a script in a solaris machine. No one of those users is root. I see I can use su commandt I think I can't pass the password as a parameter . I'm using bash. Is there anyway that I can switch user in a bash script
I've been using python/bash to help myself automate things for a long time, however I am curious. One reason I use python more is because I don't quite know how to work with user input in Bash, such as getting it to ask for input and wait, and then placing that user input into a command.
Here's an example of a script I use from time to time for converting OGG video files into AVI.
How could I write this same script in Bash? Keep in mind I am mostly self taught, so I am by no means an expert programmer.
I have a script im having some problems with, what I need is to have the system generate a random password for me and use that password when creating new users to it.
System is Debian Lenny and script is in bash.
The program is znc. I have made it so that it will generate the random password on the shell but the problem is to use it in the bnc software.
To make a password there the command is znc --makepass and look like this:
My question is now if it would be possible to put in the script so it would "answer" when it need those passwords ? the random password that is generated is in a variable called $setpass and is NOT crypted.
Or is there any other software that would be able to generate that md5 string for me ?
I'm trying to get a password in a bash script for mysql user creation. But sometimes a get a non-alphanumeric character(s) in the password, and mysql failes with that. I tryed with apg -EO0Il1`~!@#$%^&*()_+-=[];./{}|:"'<>? but failed. I tryed with sed 's/[^a-zA-Z2-9]//g' , but at that moment the minimum password lenght failed. I'm also fine when there is a better alternative then apg.
I'm trying to write a script that will prompt the user for a username/password, then create that user/password in the right groups on all my machines. I know this is kind of a long way around to avoid a NIS server, but I like making my life more difficult.
This is what I have so far:
Code:
the script has 2 problems: The "if" functions return an error and do not compare the strings successfully. whatever password is entered does get applied properly and the user is unable to login
How do you catch user input while the script is running? Or, how would you make two scripts run at the same time, but use input from one script to the other? The program I'm trying to make, echos text on the screen continuously, but while thats happening, I want the user to be able to input something, so the program can detect the input and display something else. So I thought maybe I could make two scripts run to do each task.
I'm trying to call a specific variable based on a user selection. For example:
Code: Select a file:
[1] foo.tar [2] bar.tar
Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:
Here's a challenge I've been struggling for months with:
I have a bash script that reads URL addresses of our internal server and then executes some test commands on them. Something like this:
Code: read -p "Enter URL: " url sh execute-what-ever-to $url
After copy-pasting the URL the user taps the enter key and the script proceeds, but here comes the tricky part: I want this to work without the need to press the enter key after copy-pasting the URL.
"read -n" does not work in this case, as the URLs vary greatly in length. However, the URLs always end to the same string. They could be like "http://url1/END", "http://url2/END" and so on. So this ending string "END" could be theoretically used to recognize that the whole URL has been pasted.
I have a system setup script for my Slackware installations that pulls all packages and source files from another machine and sets everything up to be identical between machines. The script works as expected but make it entirely unattended. How do I make the bash script deal with automatically selecting "Yes" for, for example "Install x(Yes/No): " when prompted by a make file?
I have been searching for 90 minutes for something that I "think" should be fairly easy. I'm pretty new to Bash Scripting so I could be completely wrong. Then again it may be a weird request to even need something like this. But here it is.I have a script written to convert data from one of our software version to another. The only thing I need to add to it is a "check to make sure the user running the script is in the /tmp directory".
the problem i have is that when i enter my username, the output (my real name) does not display in the output.txt. instead it displays in putty. so when i run my script in putty it shows the message to enter username and after i enter my username my real name appears below it. i want it to show in the output.txt
in bash scripting...say I want to take the input from a user via a question...I would do this:
Quote:
#!/bin/bash
echo "How large do you want this partition to be in GB (enter only the number)?" read PART_SIZE echo "You want your partition to be $PART_SIZE GB" But I don't want to echo it back to the screen, I want to add it to the content of /etc/fstab. I have been mucking around with sed to find the tmpfs partition in /etc/fstab and add the partition size attribute (this is to use the onboard RAM as a volatile partition)...but am not having any luck...
The portion of /etc/fstab that uses /dev/shm for the tmpfs partition is:
tmpfs /dev/shm tmpfs defaults 0 0
So, if a user says "24" GB to the answer (from above), how do I get it to automatically add that value to the tmpfs partition line in /etc/fstab? So it would look like:
tmpfs /dev/shm tmpfs size=24g,defaults 0 0
I understand that I would also have to come up with a way to put "size=XXg", which I could do with a copied over generic file before this action...then the script would have to find "XX" and replace it with the user's figure...
I'm creating a bash script to do some tasks for me. I would like the script to be run at a set time of everyday. My first question is if it is possible that if one of the commands in the script requires sudo, is there a way to get around it with out making sudo not require a password. Such as, is there a way to include the password in the script? If that is the case, I can always just set the file as read only by sudo. I've been looking for a way to do this, with no success. if I have a command that wants input, how do I give it to the program. For example, if I want to make a zip file that is encrypted, the command would go as:
Code:
zip -r example * -e
now how would I get the script to insert my wanted password.
Trying to create a small script that will read user's input, test if user entered some input and if not display some message or display a text using user's input.
The script is the following but i get an error saying "[: 6: =: argument expected"
I am trying to get bash script using zentity to exit if the user presses the cancel or close buttons.The exit codes are working fine; they read 1 or 0 depending on the status but it always assumes 0. This is the portion of the script: PHP Code:
function settings(){ result=$(zenity --height=30 --width=300 --list --checklist --title='Selection'--column=Boxes --column=Selections --column="Options"
I have a set of bash scripts which I need to execute through a web-interface. So that they can be executed remotely, once the web-interface is hosted on a server. Since this is the first time I am trying something like this, I am not sure what language or technology to use for such work. From my knowledge PHP could be a good fit. But not really sure.
I am trying to run a PHP script over and over again. I would love to be able to just write a small bash script that will just do this for me, however I am having trouble writing a for loop that works. Here is what I have now:
When I run this (./bash_import) I get the following errors:
I have also tried just doing the "php wps_product_import.php" on 20 different lines and I get an error saying it can't open the script file and only runs once.
I migrated joomla to my new server and noticed that the script doesn't have the permission to edit it's own configuration file and write to the cache folder. All my files are owned by root, which I guess isn't a good idea.
As what user do the PHP scripts run? Or is this system specific? I don't want to chmod all files to 777 so I'd just like to change file and folder ownerships to the user that is executing that script.
I have had slack 12 on this computer for quite a while with never a problem. Slack 13.1 was installed a few weeks ago without a problem, it seems to run forever as long as it is root. When I go to user it will crash 2 or 3 times a day. When it crashes it is a total lockup that only the off/on switch will reset it. There is no certain time or thing that causes it, it will just lockup while surfing using the command line switching or opening a new le. Any suggestions will be appreciated! I have googled and searched with no info found.I do have 13.1 on another computer that works fine, it has an nvidea video card in it and it is 64 bit.
I want to ask a question maybe a stupid one Here what i understand saying linux user : i can create various users for example for me , for my brother and so on to log in to system. But what does it mean that apache runs under user wwwrun and group www by default . What kind of user is that ? It's explicitly not a user kind that one I know about .
How one could determine (for use in a Bash or Python script) which device (eg /dev/sda1, /dev/hda1... etc) a ramfs was loaded from when booting from a USB drive.
I have a RIPLinux/Tinycore live USB disk that automatically needs to run a script that is stored on the same USB drive but not part of the RIPLinux/Tinycore image. (Please note that I do not want to put this script into the RIPLinux image.) I therefore would like to remix the RIPLinux/Tinycore ISO to automatically run this script once it has started up. After RIP linux has booted I would like to automatically mount the USB drive that RIPLinux/Tinycore was booted from. I need help detecting which device this is.
I'm a newbie on Linux and currently in the process of installing it. I'm planning to install the latest version of Apache, MySql, and PHP on the machine with a debugger on it. I haven't decided which debugger is suitable for this environment since I don't have any experience on it.
I am trying to implement a corba program (client) to retrieve customerinformation from the server. Since the server allow to login once andperform your operations until the lifetime experies, i want the client to use already login connection to perform the retrieve function withoutlogin in to the server for every request.Suppose retrieve has three functions, logon(), perform() and logoff()Pseudo code;Quote:
1. User runs a client application ./retrieve <URI> <customerID> 2. if the client program has already login, donot login, go to 4
I hope someone can help me with this. I need to call the same thread multiple times, but only run one thread at a time. So what I do is create the thread which runs then drops out. Run the main loop and after some time pthread_create the same thread again. So in pseudo code
[Code]...
I always presumed if I run a thread and it reaches with a pthread_exit, then the thread was destroyed? However I've found that after I've created the thread several 100 times the programme crashes? So can anyone advise how I call the same thread over and over?