UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Webmaster Discussion

Reply
 
Thread Tools Rate Thread Display Modes
Old 5th June 2008, 03:39 AM   #1 (permalink)
paulm
Registered User
 
Join Date: Oct 2007
Location: New Zealand
Posts: 5
delete a file remotely

I need to proceeduraly delete a file from my site from a remote location, but cannot think of a mechanism (that works) for doing this. The file in question is a messaging file that is retrieve using curl, but need to delete it from the UH server once I have it.
Ideally, I could use ssh with exchanged keys, but this isnt working, possibly because I'm connecting via dialup so have a dynamic IP.
This is part of an automated system, so typing a password in response to a prompt is out of the question.

I feel the solution is right there, but it's eluding me.

Thanks.
paul
paulm is offline   Reply With Quote
Old 5th June 2008, 04:35 AM   #2 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 966
you can start an ftp session to your site directly from a dos command prompt and therefore you can fetch or put or delete anything you like from your site using a simple bat file on your pc.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 5th June 2008, 08:44 AM   #3 (permalink)
desquinn
Senior Member
 
Join Date: Dec 2005
Location: Paisley
Posts: 317
the other option is to schedule a job on the server using cron to delete the file or indeed the whole copy and delete process. However percepts scripted ftp session would be nice and simple.
desquinn is offline   Reply With Quote
Old 5th June 2008, 08:46 AM   #4 (permalink)
paulm
Registered User
 
Join Date: Oct 2007
Location: New Zealand
Posts: 5
Unfortunately the remote computer is unix and it's ftp client doesnt support arbitrary connect scripts. I could achieve this result using the .netrc file, but this is a system wide setting, so the connect script would run every time the computer connects to the UH server. I could disable this for interactive ftp sessions using the -n option, but this starts to look pretty hokey, and it'll only be a matter of time before the file gets deleted accidentaly.

Desquinn -
I was under the impression that cron was unavailable. When I type 'crontab -e' I get 'command not found'. Is there something I'm missing.
Using cron is not particularly elegant - I'd have to upload a flag file saying "Ok, I have the file now, you can delete it", but it would work.

Last edited by paulm : 5th June 2008 at 08:53 AM. Reason: respond to another post
paulm is offline   Reply With Quote
Old 5th June 2008, 09:34 AM   #5 (permalink)
Terra
Registered User
 
Terra's Avatar
 
Join Date: Oct 2005
Location: old cottage
Posts: 928
Cron jobs are available via Support Ticket - you just need to send UH the details & they'll set it up for you. It's something only server admins can do. And if you have any problems with cron jobs, UH-Tony is your man - he's even managed to get all my wonky scripts to work via cron job
__________________
Underground, Overground, Wombling Free!
Terra is offline   Reply With Quote
Old 5th June 2008, 10:05 AM   #6 (permalink)
pursuit
Registered User
 
Join Date: Feb 2006
Location: London, UK
Posts: 263
i cant think of the logic why the deleting action could not be part of the retrieving process either manually or using scripts. at the end of the retrieving the file, if successful, could it not be deleted maunually (if retrieve maually), or by adding some scripts to the end of retrieving process to delete it automatically?
pursuit is offline   Reply With Quote
Old 5th June 2008, 10:28 AM   #7 (permalink)
desquinn
Senior Member
 
Join Date: Dec 2005
Location: Paisley
Posts: 317
if you have access then you can use ncftpget as it does allow scripting and is quite popular. Also the scripting could be done with winscp or ftp.exe on a windows box.

with the cron I was thinking of it doing the whole thing and therefore being in control of the whole process. It could push the file out and then delete.

This is one of those things that can be done many ways. SSH does work with keys and your local ip changing should not hamper it at all. There is a post with myself and Simon contributing on it at one point last year that covers it on UH IIRC.
desquinn is offline   Reply With Quote
Old 5th June 2008, 11:54 AM   #8 (permalink)
paulm
Registered User
 
Join Date: Oct 2007
Location: New Zealand
Posts: 5
I'll definitely hunt out that thread as the ssh route would certainly be the best. Can yo recall if it was on this forum (webmaster)?

Just to be clear about what Im trying to achieve - this will be fully automated so manualy doing anything is not an option, Its all done from the remote end - the file is pulled off the UH server not pushed, and since the control process is running remotely - how can I invoke a script to perform the delete?
paulm is offline   Reply With Quote
Old 5th June 2008, 05:51 PM   #9 (permalink)
percepts
Senile Member
 
percepts's Avatar
 
Join Date: Mar 2005
Posts: 966
you set up a php script on the UH server which deletes the file. Your client/remote service would just need to make an http request for the php script and it would be executed.
__________________
An old dog learning new tricks
percepts is offline   Reply With Quote
Old 5th June 2008, 09:12 PM   #10 (permalink)
UH-Tony
Senior Server Administrator
 
UH-Tony's Avatar
 
Join Date: Mar 2006
Location: Houston, TX USA
Posts: 489
To save much time and stress over this, send a support ticket in with a detailed explanation of what you would like to accomplish and I will be happy to provide suggestions as to effective ways to accomplish it.
__________________
.
Tony
UnitedHosting Staff

For official support please use our helpdesk at UnitedSupport.co.uk

UnitedHosting proudly hosting more than 20,000 sites since 1998.
UH-Tony is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 06:39 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309