Programming :: Shell Script That Serves As A Toggle?

Jun 25, 2010

I often have a need for an icon on my panel or any place that toggles between two states. Example: click the button once and it turns on the Internet (1), click the button again and it turns off the Internet(2), click the button again and it turns the Internet on again (1).The only way I know is to have a script create and delete a file. If it finds no file, it runs operation 1 and creates a file. If it finds the file, it runs operation 2 and deletes the file.

View 4 Replies


ADVERTISEMENT

Programming :: Bash Script To Toggle A Daemon (here Proftpd)?

Jan 5, 2010

I want to create a script which toggles a daemon (here proftpd). On the first execution it should start it and on the next one it should stop it but first check if proftpd is already running or not (and make the decision to start or stop on that).I have created this script:

Code:
#!/bin/sh
# proftpd-toggle

[code]...

View 14 Replies View Related

Programming :: Shell Scripting / Create A Shell Script Similar To Ls?

Jun 5, 2011

I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.

Code:
if [ $# -eq 0 ] ; then
d=`pwd`
for i in * ; do
if test -d $d/$i ; then
echo "$i:"
code....

View 10 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Server :: Apache Serves Up Website From Any URL?

Feb 17, 2011

I'm running Ubuntu 10.04 with apache, rails, mysql, etc. My rails site is running at www.example.com. I'm intending to use named-based virtual hosting and I have a virtual hosts file configured/enabled for www.example.com. My site is hosted on Amazon EC2.

The problem is that if I set up a new DNS record -- say test.example.com -- and browse to that, my site www.example.com is served up! That's without configuring any new virtual hosts. And the same is true if I go to my DNS records and define test2.example.com, etc. Without touching my server, these new URLs serve up my website. That's not what I want! I want to use name-based virtual hosting and host different sites for each subdomain.

[Code]...

UPDATE: now I understand a bit more... apparently my real problem is not what I thought it was. My real problem now appears to be that when I copy this virtual hosts file and edit it to add a new subdomain name, set up the corresponding site, etc., and enable the virtual host (a2ensite) and restart (graceful), apache immediately stops serving up any websites. Apparently apache crashes although I do not see any error messages. But all my sites go down and I have to revert and then restart apache.

I thought this was because my virtual host file (pasted above) had an error. So I thought I would start by getting that first file right. Apparently it is right. So now I need to understand why adding a second virtual host causes all sites to stop being served up.

View 1 Replies View Related

Server :: Internal DNS Setup That Serves LAN?

Jan 31, 2010

I want to have an internal DNS that would serves our LAN and I also had external DNS server (located on our ISP). I have configured my internal DNS .. by adding new A record named test.mydomain.com (for example) and I knew that test.mydomain.com also exists as A record on external DNS server. When I ping test.mydomain.com .. it still return from 202.x.x.x (it should be return from 172.16.250.1? It seems like my internal DNS config below not configured properly..

// named.conf
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
// See /usr/share/doc/bind*/sample/ for example named configuration files.

options {
listen-on port 53 { 172.16.250.2; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt"; .....

View 1 Replies View Related

Server :: Apache Serves On Localhost But Not With Network

Nov 28, 2010

I have Apache2 running on my server and can serve up pages on that box, but cannot seem to access them from other PCs on the network.

View 1 Replies View Related

Ubuntu :: Remove The Envelope Icon That Serves To Emphaty?

May 10, 2010

how to remove the envelope icon that serves to emphaty, evolution and gwibber which is next to the clock?

View 2 Replies View Related

Ubuntu :: Program / Operating System To Serves Purpose Of Managing OSs In Nature Of Simplicity?

Aug 19, 2010

Does anybody know of a program and/or an Operating System in which serves the purpose of managing OSs in a nature of simplicity? Sure would save so much time i spend reinstalling linux every time its brakes.

View 3 Replies View Related

Programming :: Prevent "leak" Into Shell From A Customized Shell Menu Script?

Dec 15, 2009

I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.

View 11 Replies View Related

Programming :: Shell Programming - Delete User Input

Jan 21, 2011

I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.

Do i have to use sed command?

View 4 Replies View Related

Programming :: Possible To Assist In Programming Shell Scripts?

May 17, 2010

Is it possible to assist in the programming Shell Scripts
Job:
To send a message to the email,All orders written in Terminal or ssh
example : ls , pwd , cat , and other

View 1 Replies View Related

Programming :: How To Turn Non-interactive Shell Into Interactive Shell?

Feb 4, 2011

I have a situation where I am in a non-interactive shell. I have tried from within my non-interative shell to spawn an interactive shell but my output still does not goto me. Isn't there a way I can somehow go into /proc or somwhere and make the output my /dev/tty1? Or some way else to remedy this?The situation arises because I drop from my restricted shell environment (a sort of CLI interface), into the actual Linux shell. I cannot change the code of the CLI environment I am just faced with being in the linux shell environment and its non-interactive. Its very annoying to have to put > /dev/tty1 after every command I type.

Not to mention it seems damn near impossible to get pagers like more and less to work properly when your in a non-interactive shell.

View 2 Replies View Related

Fedora :: Toggle The Side Bar On And Off?

Aug 24, 2009

One - where is the setting so when I click into a file it opens in the same Window instead of a new one?

Two - how can I toggle the side bar on and off like Ubuntu/SUSE nautilus have?

View 3 Replies View Related

Debian :: Toggle Between Nouveau And NVidia?

Jun 2, 2011

Now that nVidia is up and running, I'm curious to do a comparison with Nouveau. I there an EASY way to do this? Like a simple on/off switch? Major system/kernel changes are not an acceptable option. If it can't be easily done, I'll just stick with nVidia.

View 4 Replies View Related

Ubuntu :: Toggle Between Breadcrumbs And Location Bar?

Apr 29, 2010

how do I toggle between breadcrumbs and location bar? Ctrl L just doesn't do anything, just gives focus to the already existing location bar.

I'd like breadcrumbs back.

View 6 Replies View Related

Ubuntu :: Toggle Key For Wallpapers On 4 Desktops

May 5, 2010

I would like to toggle between 2 or more wallpapers on my 4 desktops (Compiz) with a simple hot key. Is there a command I can add to the Compiz command settings that toggles between 2 wallpapers?

View 8 Replies View Related

Ubuntu :: Toggle 'Show Desktop'?

May 8, 2010

I got rid of my bottom panel, but I am still used to 'Show Desktop' button right in the bottom left corner. I was just thinking is it possible to Toggle 'Show Desktop' state just by moving my mouse in that corner?I was thinking of using wmctrl and compiz commands edge biding, but my problem is that wmctrl has two different commands - one for showing desktop one for hiding. But I want to toggle.

View 4 Replies View Related

Ubuntu :: Monitor Toggle In Unity

May 11, 2011

I can't use function key combination to toggle between connected monitor and laptop monitor of my Dell N4010, running Ubuntu Natty.This happens in Unity interface only. In gnome (Ubuntu classic), function key combination works fine.When I press Fn+F1, it acts similar to pressing super+F1.

View 2 Replies View Related

OpenSUSE Install :: Toggle Between A Gnome And KDE Desktops?

Jun 7, 2011

Is there a way to toggle between a gnome and KDE desktops?

View 9 Replies View Related

Ubuntu :: Script To Toggle Window Visibility?

Apr 4, 2011

I need a script/tool/whatever to toggle visibility of a specified window. I'm using Ubuntu with GNOME and compiz. I found wmctrl which can maximize, minimize windows and so on, but it couldn't make a window "hidden". There is even a option for it, but it doesn't work (neither for me nor for this guy creating this manual: [URL]

So my question: Is there another way to toggle visibility of a window? Any tool for that or even any commands for a bash script?

View 3 Replies View Related

General :: What Is Short Cut Key To Toggle Between Pseudo Terminals In Red Hat?

Apr 21, 2011

what is short cut key to toggle between pseudo terminals in red hat? how can i create customized short cut keys in red hat?

View 2 Replies View Related

Programming :: Shell Script To Tee ITSELF

Dec 10, 2008

I have a shell script that I would like to log to stdout and also to a file.....much like using tee. I would like to, instead of calling the script and piping to tee...i would like for the script to tee itself.

View 4 Replies View Related

Programming :: How To Create Own C Shell

Jul 11, 2010

i got to build my own linux shell for my project

View 5 Replies View Related

Programming :: Can Awk Take A Shell Variable

Jul 23, 2010

I have been searching most of today and am stuck on getting a variable into an awk portion of my bash script. I have this working:

Code:

#!/bin/sh
SRC=/var/log/mail.log
DEST=/var/www/output/myFile.txt
VAR=userName@myDomain.tld

[code]....

Can awk take a shell variable? Or do I have to do something completely different?

View 11 Replies View Related

Programming :: How To Use Scp In A Shell Script

Apr 2, 2011

I need to push out a file to a bunch of linux and solaris boxes so I was hoping to use a script to automate the process with scp (or something else / better) - how can I batchmode scp so that it will do this? I should mention the servers do have keys set up so I do not have to authenticate manually or through something like an expect script...

View 4 Replies View Related

Programming :: Reg Sed On Shell Script?

Feb 16, 2010

I am having a shell script with following lines

ORIG_LOG_ARCHIVE_FORMAT=`grep log_archive_format $LOG_DIR/init$CLONE_DB.ora | cut -d"=" -f2`
SRC_LOG_ARCHIVE_FORMAT=`sqlplus -s "/ as sysdba" @$SCRIPTS_DIR/log_archive_format.sql`
echo $ORIG_LOG_ARCHIVE_FORMAT

[code]...

When I execute this script I am getting below output

'enin16_%t_%s_%r.arc'
enip131_%t_%s_%r.arc
sed: command garbled: s/'enin16_%t_%s_%r.arc'/

However when I do the exact above command on unix prompt (refer below) after setting values for all variables, it is not giving sed garbled error message. May I know what should I do to make it work inside the script as well?

$ cat init_refresh$CLONE_DB.ora | sed "s/$ORIG_LOG_ARCHIVE_FORMAT/$SRC_LOG_ARCHIVE_FORMAT/g" > $LOG_DIR/init_refresh1$CLONE_DB.ora
$

View 3 Replies View Related

Programming :: How To Write A Toy Shell

Mar 24, 2011

I'm trying to write a toy linux shell. For starters this is what I'm trying to do:

1. Start a new process with fork.

2. Execute a program in the new process with execl().

3. Redirect the output from the new process from STDOUT to another file descriptor, using dup2(2).

4. In the parent process, read the output from the child process and write it to the screen.

Creating a new process and executing a program in it is no problems, the problem is that I can't seem to capture the output from it in the parent process.

Code:

//digenv
//C++arl 2011-03-24
#include <stdio.h>
#include <sys/types.h>

[code]...

View 14 Replies View Related

Debian :: Silverlight Is Required To Play Videos On Toggle

Feb 23, 2016

Using Jessie, Iceweasel 38.6.1 and

Shockwave Flash

File: libflashplayer.so
Path: /usr/lib/flashplugin-nonfree/libflashplayer.so
Version: 11.2.202.569
State: Enabled
Shockwave Flash 11.2 r202

Cannot view video from [URL] ....

Pop-up window says Silverlight is required to play videos on Toggle.

Google around but no Silverlight for Linux.

View 4 Replies View Related

Debian Multimedia :: Using Xrandr To Toggle Laptop Display

Jun 3, 2015

Background: I am running Debian 8 with the Xfce DE on my Toshiba Satellite Laptop.

When at home I will connect my laptop to an external display. I did the same while I was running Ubuntu; however, with Ubuntu I could activate my laptop display by simply disconnecting the external monitor. With Debian + Xfce, unplugging the external monitor leaves my laptop screen blank.

In order to activate my laptop display, I have to open Display settings, turn on laptop display -- which still leaves my laptop screen blank -- and then switch resolution: there are two listings for 1366x768 under resolution, and only the second one restores my laptop display. Please note that if I have both displays on at the same time the size of the output on my external monitor will be reduced to about the size of my laptop's display.

I would like the create a Bash script which can automatically switch between my displays. After some Googling it seems like xrandr is the tool I need for the job. However, I have been having trouble getting it to work.

I tried the command Code: Select allxrandr --output LVDS1 --auto --primary --output HDMI1 --off. This however just turns my external display off without turning on my laptop's display. I suspect this has something to do with the fact that LVDS1 has two modes at 1366x768; perhaps only one of them can actually display? I'm not sure, but anyways here's the output of xrandr:

Code: Select allScreen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768      59.99*+
   1360x768      59.80    59.96 
   1024x768      60.00 
   800x600       60.32    56.25 

[Code] ....

Is there a way I can specify that xrandr should use the second 1366x768 mode?

I just realized that the second mode is, in fact, 1360x768 rather than 1366x768...

The good news is that I fixed my problem. It turns out that my backlight was not turning on, giving the appearance that my laptop screen was not displaying anything.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved