Evgeny Pokhilko's Weblog

Programmer's den

Run a bash script with sudo, nohup and in the background

This command will run script.sh under super user and you can disconnect and come back later:

sudo nohup bash script.sh &

It’s useful if you don’t have Screen or you want the process to close when it finishes without a screen session hanging around.

By default, the output will go to nohup.out. You can change it by redirecting it to a file:

sudo nohup bash script.sh > script.out &

nohup runs a command immune to hangups. It redirects input and output of the process. If you want to connect to the server again and see the output, use tail, as below:

tail -f script.out

The command will  be printing output as your command produces it as if it runs in your terminal session. Ctrl-C will terminate tail but not the nohup command.

If you need to kill the command before it finishes, find the process id first with:

sudo ps -Af | grep “bash script.sh”
sudo kill <process id>

I hope it helps.

February 20, 2012 Posted by | Linux, Networking | | 3 Comments

Contact database with web interface – EVPO Members

I am opening the source of a small project that I made for a charity organisation http://evpomembers.codeplex.com.

This is a web based contact database. The database stores information on individual members with their contact details, general information and how they are connected to each other. The list of features includes:

  • Editable look-ups for most fields
  • Multiple contacts per one address
  • Convenient search for contact names and addresses
  • Log-in support to prevent unauthorized access
  • Customisable export to Excel compatible XML

Minimal Software requirements:

  • Microsoft SQL 2005
  • .NET Framework 3.5

Dependencies:

  • AJAXControlToolkit

License:

EVPO Members Copyright © 2012 Evgeny Pokhilko
evpomail@gmail.com http://www.evpo.net

EVPO Members is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

EVPO Members is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with EVPO Members. If not, see http://www.gnu.org/licenses.

Installation:

  1. Download the source from the SVN repository.
  2. Create ContactData database in SQL and restore empty.bak
  3. Run apsnet_regsql from Visual Studio command line and install aspnetdb. Leave default settings mostly in the wizard.
  4. Create a SQL log-in (ContactDataUser for example with password 1).
  5. Grant access to the log-in to the ContactData and aspnetdb databases.
  6. Download AjaxControlToolkit (http://ajaxcontroltoolkit.codeplex.com/,go to All Downloads and download the package for .NET 3.5 !!!) for .NET 3.5 and unzip it to the AjaxControlToolkit directory.
  7. Open the solution and rebuild it.
  8. Open UI\web.config
  9. Update the two connection strings making them valid for the ContactData and aspnetdb databases respectively.
  10. In Visual Studio go to Project/ASP.NET Configuration
  11. On the opened web page go to Security/Create User
  12. Specify any user name and password so you can log in to the web app
  13. Ctrl+F5 in Visual Studio
  14. You should see the home page of the web app in your browser

Screenshots:

1. Address

Members-Addresses

 

2. Contact Form

Members-Contact

 

3. Export

Members-Export

 

4. Relationships

Members-Relationships

 

5. Summary

Members-Summary

 

6. Lookups

Members-TitlesLookup

 

February 11, 2012 Posted by | .NET, ASP.NET, SQL | , , | Leave a comment