General :: Enable - Disable Logging In A Bash Script ?
Oct 19, 2010
My objective is pretty simple: To have a variable within a bash script where I can switch between logging to file or screen.
Simple example of what I am trying to do:
Code:
So, as you can see, I have a variable which clears the log path if the user variable vLOG is not 'Y'. This should mean the user can run the script from the command line and view all the output (instead of it going to a log file).
The problem is that with the final line of the script (which ultimately tests the intention), I don't get the required result as the vLOGPATH variable is just passed to echo as text.
I have tried using 'echo -e' and getting some backslashes in there, I have tried using eval but I am either using them incorrectly.
My question is simple, is it possible to enable and disable automatic sleep/hibernate/standby using BASH? I need it for a bash script.Been searching for a while now, can't seem to find it.
Everytime I log into the linux server at my workplace (I use putty), I don't get the bash prompt right away. I need to execute the command 'bash' to get it. Anyway to make this automatic? e.g.
I can set my EDITOR variable in my .bashrc to e.g. gedit, which is a nice graphical editor on ubuntu. But when I log in over PuTTY that editor will fail.What is the best way to detect if I'm logged in and can run a graphical editor, or not, and set EDITOR appropriately?
I used ubuntu and recently install Mandriva in to my laptop.I install both Kde and gnome desktop.I like to have kwin effects in kde . But i cant enable Kwin animation in kde and Compiz fusion animation occur in both Kde and gnome.
I am using Fedora 14. By default Security Enhanced Linux is enabled in Fedora 14. Now is there any way to disable it by command line and then again enable it through command line.
Chkconfig is a utility to update and query runlevel information for system services. Chkconfig manipulates the numerous symbolic links in /etc/init.d/, to relieve system administrators of some of the drudgery of manually editing the symbolic links.
In Debian, there are several tools with similar functionality, but users coming from other Linux distributions will find the tools in this package more familiar.
Go to Terminal and open it and type the command "chkconfig' press enter. code...
after installing just type "chkconfig" you can see list of service which one is off or on in your system code...
I've enabled the root account on Ubuntu 9.10, however I want to stop it from being used to login via GDM. 9.10 seems to have a different GDM version, how can I carry this out under 9.10
I wanted to disable root logins in console, so I searched for that. I found that if I change root's bash to "/sbin/nologin" in "/etc/passwd", root user will not be able to login. So I did that. But when I wanted to use sudo command, it didn't show me root bash, but it only do the same thing as logging in as root in single user mode (shows message that this account is disabled). So, how I can disable root logins, but keep enabled sudo command for standard users?
I am having a problem with bringing up a two node cluster. It picks up a cluster configuration file from another cluster on the network where of course it does not find the local node I've disabled openais, change the configuration to use a different ring but it is still happening. I get the following error message code...
Is there a way to boost the logging for cman and openais so I can get more clues as to why it it is happening? I've only seen postings telling how to do it for resource manager .
How i can configure syslogs/rsyslog to receive third party tools or softwares logs. For example i have a program that generates logs like when it is started and logs about its services, alerts if there are any alarms etc. I want to forward these logs using syslogs/rsyslog.
I need to write a bash script that will allow me to manage my "virtual network" (in reality just a bunch of directories and files). I need to obtain something like : I have my own command 'connect'. We can use it in two different modes: user and admin. If I type 'connect adashiu virtual_machine_name, computer will ask about password, if password is correct he will change a prompt to :
adashiu_at_virtual_machine_name >
after that user can start to use commands reserved only for user mode. Analogically with admin mode: prompt 'admin >' and administrator can only use bunch of commands reserved for him. changing prompt and separated commands for user and admin ?
how to disable gstreamer???? (and be able to re-enable it also?) i don't want to totally remove gstreamer - as it is required by alot of software. however, when i am using proaudio apps with low-latency having gstreamer enabled is a problem. this is because ( i think ) that my crappy intel-hda (STAC9200) only has one sub-device, while many other cards have multiple.
so when gstreamer is there, i will get more xruns, and a nasty message in dmesg, something along the lines of "intel-hda switching to polling mode". overall performance of the card will suck. BUT! if gstreamer is NOT there, i can run low-latency(2ms) with pretty much no xruns(jackd). the only time i get the odd one is if i am switching drum banks in a wine VST.
well, i remove pulseaudio when i install Fedora, gstreamer doesn't work properly after that, you can't use rhythmbox, or anything. but you will get much better latencies and generally the card is very useful. ie: i can manipulate many sounds/samples/synths in realtime, or actually record in ardour with a decent load...
Sorry but I'm a new user and would like to know how to enable/disable firewall. I have tried to open a port up on my firewall but, for some reason that didn't work. I have found these command in another thread: $ sudo /sbin/chkconfig iptables off $ sudo /sbin/service iptables stop I assume this is to disable the fire wall. How do I enable it once I'm finish running my program.
I've downloaded from the Ubuntu software center a touch-pad application that allows me to set some preferences to my touch-pad. So since I rather use a mouse, I've disabled it, the problem is, it only keeps disabled for a few minutes, later it works again. So I want to keep disabled until I enable it again, any suggestions?
is there a way to enable/disable specified hardware? Allow me to explain, i have 2 wireless adapters, one integrated and one USB, i want to use the USB adapter for 5Ghz 802.11n and the integrated wifi adapter in my system is the one ubuntu is defaulted to.. i have the drivers for the USB device already installed i just need to disable the integrated device.
I have 4 computers and I currently have 4 USB cradles so every time I want to switch to a new computer I have to unplug the keyboard/mouse dongle and replug it in the appropriate cradle. I would prefer to connect the single dongle to a 4 way USB switch then choose the target computer by remapping 4 of the keys I don't need, for example:
Anyway, according to the release notes, RHEL 6 has a PAE enabled kernel by default. Great... But that leaves me wondering why uname report SMP. Further, I'm provisioning some systems for QA use, and they're asking that PAE is disabled. My thinking is that since RHEL 6 requires PAE capability to install, there may be no way to disable it and the googling I've done seems to support this. tl;dr Why does a default kernel with PAE enabled report SMP on RHEL 6?
Since last Saturday (11-20) my touchpad enable/disable key stopped working.I don't make much use of the touchpad and it usually stays disabled most of the time so I can't be sure it is really on Saturday that I lost this functionality or maybe the day before (I'm positive it's not longer than that).Before that it worked flawlessly, now it's like a dead key (which is not broken by the way, tested on a live CD).In these past week I have been looking for quite some time for other users who might have experienced this problem after the update of two specific packages (console-data and keyboard-configuration) I had on the 20th and which made me think might have broken the key binding.Not finding anything at all and after having tried for said packages both newer versions from sid and previous known-to-have-worked-before versions from the install CD, I started thinking the problem was not there (I consequently restored the testing ones).
The days before this happened I tinkered a little bit with gpointing-device-settings and tpconfig (this last one was a simple tpconfig -i), but at this point I start thinking there might have been something else I've done, somewhere else I can't recall probably.
Oh, I forgot to mention that the touchpad still works flawlessly, I can enable/disable it through gconf (actually I made two handy shortcut to the "/desktop/gnome/peripherals/touchpad/touchpad_enabled" value), so it is not an issue of making it work, just the toggle key which on my laptop is a dedicated one (no Fn modifier) and anyway all the other special keys still work fine.I checked gnome-keybinding-properties and there is no action for the touchpad there, but I don't know for sure if there was one before (and I haven't been able to add one). Anyway in gconf I noticed a key in "/apps/gnome_settings_daemon/keybindings/touchpad" has the value "XF86TouchpadToggle", not sure if that means the keybinding exists or what.
What more can I add? What I'm here to ask now is some guidance on figuring out what I might have done wrong considering what I was able to tell you, but mostly, considering what I wasn't able to tell you and am not even aware to have done.
I'm looking for some definitive instruction on the proper way to enable/disable (not to simply start/stop or add/remove packages) services/daemons under Debian 6. Google results are all over the map and, surprisingly, the Debian wiki has no abstract on services.It seems like such a common task